All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
       [not found] <E1ZAgI1-0000jO-Kb@sd-51317.xenomai.org>
@ 2015-07-02 15:24 ` Philippe Gerum
  2015-07-02 15:39   ` Jan Kiszka
  0 siblings, 1 reply; 28+ messages in thread
From: Philippe Gerum @ 2015-07-02 15:24 UTC (permalink / raw)
  To: xenomai, xenomai-git

On 07/02/2015 05:20 PM, git repository hosting wrote:
> Module: xenomai-jki
> Branch: for-forge
> Commit: 99736c29a21a5e5536f8db9e580fd11cdb0eb0f2
> URL:    http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=99736c29a21a5e5536f8db9e580fd11cdb0eb0f2
> 
> Author: Jan Kiszka <jan.kiszka@siemens.com>
> Date:   Thu Jul  2 17:12:39 2015 +0200
> 
> cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL

We want to keep this. At some point, maybe, we will be able to use this
information to instrument the code with calling context guards, or as
the source of the mode data in the syscall table. Today, it's at least
useful inline documentation, without having to browse the table.

-- 
Philippe.


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
  2015-07-02 15:24 ` [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL Philippe Gerum
@ 2015-07-02 15:39   ` Jan Kiszka
  2015-07-02 16:30     ` Philippe Gerum
  0 siblings, 1 reply; 28+ messages in thread
From: Jan Kiszka @ 2015-07-02 15:39 UTC (permalink / raw)
  To: Philippe Gerum, xenomai

On 2015-07-02 17:24, Philippe Gerum wrote:
> On 07/02/2015 05:20 PM, git repository hosting wrote:
>> Module: xenomai-jki
>> Branch: for-forge
>> Commit: 99736c29a21a5e5536f8db9e580fd11cdb0eb0f2
>> URL:    http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=99736c29a21a5e5536f8db9e580fd11cdb0eb0f2
>>
>> Author: Jan Kiszka <jan.kiszka@siemens.com>
>> Date:   Thu Jul  2 17:12:39 2015 +0200
>>
>> cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
> 
> We want to keep this. At some point, maybe, we will be able to use this
> information to instrument the code with calling context guards, or as
> the source of the mode data in the syscall table. Today, it's at least
> useful inline documentation, without having to browse the table.

This only makes sense when cobalt_sysmodes can be generated from it.
Currently it isn't, and I bet there are already plenty of
inconsistencies, minimizing the value captured via COBALT_SYSCALL
massively. So we should either get rid of cobalt_sysmodes or of that
parameter.

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
  2015-07-02 15:39   ` Jan Kiszka
@ 2015-07-02 16:30     ` Philippe Gerum
  2015-07-02 16:44       ` Jan Kiszka
  0 siblings, 1 reply; 28+ messages in thread
From: Philippe Gerum @ 2015-07-02 16:30 UTC (permalink / raw)
  To: Jan Kiszka, xenomai

On 07/02/2015 05:39 PM, Jan Kiszka wrote:
> On 2015-07-02 17:24, Philippe Gerum wrote:
>> On 07/02/2015 05:20 PM, git repository hosting wrote:
>>> Module: xenomai-jki
>>> Branch: for-forge
>>> Commit: 99736c29a21a5e5536f8db9e580fd11cdb0eb0f2
>>> URL:    http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=99736c29a21a5e5536f8db9e580fd11cdb0eb0f2
>>>
>>> Author: Jan Kiszka <jan.kiszka@siemens.com>
>>> Date:   Thu Jul  2 17:12:39 2015 +0200
>>>
>>> cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
>>
>> We want to keep this. At some point, maybe, we will be able to use this
>> information to instrument the code with calling context guards, or as
>> the source of the mode data in the syscall table. Today, it's at least
>> useful inline documentation, without having to browse the table.
> 
> This only makes sense when cobalt_sysmodes can be generated from it.
> Currently it isn't, and I bet there are already plenty of
> inconsistencies, minimizing the value captured via COBALT_SYSCALL
> massively. So we should either get rid of cobalt_sysmodes or of that
> parameter.
> 

"currently" is the point. If you feel implementing either aspects, i.e.
automatic tagging of the current context when traversing a cobalt call
based on the mode in the syscall macro, or generating the table data
based on the info, please do. If you feel fixing any consistency between
the two mode specs proving your bet right, please do as well. But for
now, I won't pick that commit.


-- 
Philippe.


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
  2015-07-02 16:30     ` Philippe Gerum
@ 2015-07-02 16:44       ` Jan Kiszka
  2015-07-02 16:49         ` Gilles Chanteperdrix
  0 siblings, 1 reply; 28+ messages in thread
From: Jan Kiszka @ 2015-07-02 16:44 UTC (permalink / raw)
  To: Philippe Gerum, xenomai

On 2015-07-02 18:30, Philippe Gerum wrote:
> On 07/02/2015 05:39 PM, Jan Kiszka wrote:
>> On 2015-07-02 17:24, Philippe Gerum wrote:
>>> On 07/02/2015 05:20 PM, git repository hosting wrote:
>>>> Module: xenomai-jki
>>>> Branch: for-forge
>>>> Commit: 99736c29a21a5e5536f8db9e580fd11cdb0eb0f2
>>>> URL:    http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=99736c29a21a5e5536f8db9e580fd11cdb0eb0f2
>>>>
>>>> Author: Jan Kiszka <jan.kiszka@siemens.com>
>>>> Date:   Thu Jul  2 17:12:39 2015 +0200
>>>>
>>>> cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
>>>
>>> We want to keep this. At some point, maybe, we will be able to use this
>>> information to instrument the code with calling context guards, or as
>>> the source of the mode data in the syscall table. Today, it's at least
>>> useful inline documentation, without having to browse the table.
>>
>> This only makes sense when cobalt_sysmodes can be generated from it.
>> Currently it isn't, and I bet there are already plenty of
>> inconsistencies, minimizing the value captured via COBALT_SYSCALL
>> massively. So we should either get rid of cobalt_sysmodes or of that
>> parameter.
>>
> 
> "currently" is the point. If you feel implementing either aspects, i.e.
> automatic tagging of the current context when traversing a cobalt call
> based on the mode in the syscall macro, or generating the table data
> based on the info, please do. If you feel fixing any consistency between
> the two mode specs proving your bet right, please do as well. But for
> now, I won't pick that commit.

The approach of using COBALT_SYSCALL to define the mode only works if
that is also the only place to define it. Let's see first if/how that
can be achieved.

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
  2015-07-02 16:44       ` Jan Kiszka
@ 2015-07-02 16:49         ` Gilles Chanteperdrix
  2015-07-02 16:56           ` Philippe Gerum
  2015-07-02 16:56           ` Gilles Chanteperdrix
  0 siblings, 2 replies; 28+ messages in thread
From: Gilles Chanteperdrix @ 2015-07-02 16:49 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai

On Thu, Jul 02, 2015 at 06:44:06PM +0200, Jan Kiszka wrote:
> On 2015-07-02 18:30, Philippe Gerum wrote:
> > On 07/02/2015 05:39 PM, Jan Kiszka wrote:
> >> On 2015-07-02 17:24, Philippe Gerum wrote:
> >>> On 07/02/2015 05:20 PM, git repository hosting wrote:
> >>>> Module: xenomai-jki
> >>>> Branch: for-forge
> >>>> Commit: 99736c29a21a5e5536f8db9e580fd11cdb0eb0f2
> >>>> URL:    http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=99736c29a21a5e5536f8db9e580fd11cdb0eb0f2
> >>>>
> >>>> Author: Jan Kiszka <jan.kiszka@siemens.com>
> >>>> Date:   Thu Jul  2 17:12:39 2015 +0200
> >>>>
> >>>> cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
> >>>
> >>> We want to keep this. At some point, maybe, we will be able to use this
> >>> information to instrument the code with calling context guards, or as
> >>> the source of the mode data in the syscall table. Today, it's at least
> >>> useful inline documentation, without having to browse the table.
> >>
> >> This only makes sense when cobalt_sysmodes can be generated from it.
> >> Currently it isn't, and I bet there are already plenty of
> >> inconsistencies, minimizing the value captured via COBALT_SYSCALL
> >> massively. So we should either get rid of cobalt_sysmodes or of that
> >> parameter.
> >>
> > 
> > "currently" is the point. If you feel implementing either aspects, i.e.
> > automatic tagging of the current context when traversing a cobalt call
> > based on the mode in the syscall macro, or generating the table data
> > based on the info, please do. If you feel fixing any consistency between
> > the two mode specs proving your bet right, please do as well. But for
> > now, I won't pick that commit.
> 
> The approach of using COBALT_SYSCALL to define the mode only works if
> that is also the only place to define it. Let's see first if/how that
> can be achieved.

That can be achieved by getting the macro to adding data in a
special section, then use that section as the syscall table with
linker generate symbols. A lot of stuff works like this, like the
init table, or glibc constructors, so, this can definitely be
achieved. This probably requires the I-pipe patch to modify the
kernel linker script, of which there are several instances (one
instance by arch maybe).

-- 
					    Gilles.
https://click-hack.org


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
  2015-07-02 16:49         ` Gilles Chanteperdrix
@ 2015-07-02 16:56           ` Philippe Gerum
  2015-07-02 17:03             ` Gilles Chanteperdrix
  2015-07-02 16:56           ` Gilles Chanteperdrix
  1 sibling, 1 reply; 28+ messages in thread
From: Philippe Gerum @ 2015-07-02 16:56 UTC (permalink / raw)
  To: Gilles Chanteperdrix, Jan Kiszka; +Cc: xenomai

On 07/02/2015 06:49 PM, Gilles Chanteperdrix wrote:
> On Thu, Jul 02, 2015 at 06:44:06PM +0200, Jan Kiszka wrote:
>> On 2015-07-02 18:30, Philippe Gerum wrote:
>>> On 07/02/2015 05:39 PM, Jan Kiszka wrote:
>>>> On 2015-07-02 17:24, Philippe Gerum wrote:
>>>>> On 07/02/2015 05:20 PM, git repository hosting wrote:
>>>>>> Module: xenomai-jki
>>>>>> Branch: for-forge
>>>>>> Commit: 99736c29a21a5e5536f8db9e580fd11cdb0eb0f2
>>>>>> URL:    http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=99736c29a21a5e5536f8db9e580fd11cdb0eb0f2
>>>>>>
>>>>>> Author: Jan Kiszka <jan.kiszka@siemens.com>
>>>>>> Date:   Thu Jul  2 17:12:39 2015 +0200
>>>>>>
>>>>>> cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
>>>>>
>>>>> We want to keep this. At some point, maybe, we will be able to use this
>>>>> information to instrument the code with calling context guards, or as
>>>>> the source of the mode data in the syscall table. Today, it's at least
>>>>> useful inline documentation, without having to browse the table.
>>>>
>>>> This only makes sense when cobalt_sysmodes can be generated from it.
>>>> Currently it isn't, and I bet there are already plenty of
>>>> inconsistencies, minimizing the value captured via COBALT_SYSCALL
>>>> massively. So we should either get rid of cobalt_sysmodes or of that
>>>> parameter.
>>>>
>>>
>>> "currently" is the point. If you feel implementing either aspects, i.e.
>>> automatic tagging of the current context when traversing a cobalt call
>>> based on the mode in the syscall macro, or generating the table data
>>> based on the info, please do. If you feel fixing any consistency between
>>> the two mode specs proving your bet right, please do as well. But for
>>> now, I won't pick that commit.
>>
>> The approach of using COBALT_SYSCALL to define the mode only works if
>> that is also the only place to define it. Let's see first if/how that
>> can be achieved.
> 
> That can be achieved by getting the macro to adding data in a
> special section, then use that section as the syscall table with
> linker generate symbols. A lot of stuff works like this, like the
> init table, or glibc constructors, so, this can definitely be
> achieved. This probably requires the I-pipe patch to modify the
> kernel linker script, of which there are several instances (one
> instance by arch maybe).
> 

Yes. Having to fixup the linker script was the reason not to implement
this immediately, as there could be some backward compat issues to
address with legacy pipelines running a most recent 3x cobalt core.

-- 
Philippe.


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
  2015-07-02 16:49         ` Gilles Chanteperdrix
  2015-07-02 16:56           ` Philippe Gerum
@ 2015-07-02 16:56           ` Gilles Chanteperdrix
  2015-07-02 17:31             ` Jan Kiszka
  1 sibling, 1 reply; 28+ messages in thread
From: Gilles Chanteperdrix @ 2015-07-02 16:56 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai

On Thu, Jul 02, 2015 at 06:49:33PM +0200, Gilles Chanteperdrix wrote:
> On Thu, Jul 02, 2015 at 06:44:06PM +0200, Jan Kiszka wrote:
> > On 2015-07-02 18:30, Philippe Gerum wrote:
> > > On 07/02/2015 05:39 PM, Jan Kiszka wrote:
> > >> On 2015-07-02 17:24, Philippe Gerum wrote:
> > >>> On 07/02/2015 05:20 PM, git repository hosting wrote:
> > >>>> Module: xenomai-jki
> > >>>> Branch: for-forge
> > >>>> Commit: 99736c29a21a5e5536f8db9e580fd11cdb0eb0f2
> > >>>> URL:    http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=99736c29a21a5e5536f8db9e580fd11cdb0eb0f2
> > >>>>
> > >>>> Author: Jan Kiszka <jan.kiszka@siemens.com>
> > >>>> Date:   Thu Jul  2 17:12:39 2015 +0200
> > >>>>
> > >>>> cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
> > >>>
> > >>> We want to keep this. At some point, maybe, we will be able to use this
> > >>> information to instrument the code with calling context guards, or as
> > >>> the source of the mode data in the syscall table. Today, it's at least
> > >>> useful inline documentation, without having to browse the table.
> > >>
> > >> This only makes sense when cobalt_sysmodes can be generated from it.
> > >> Currently it isn't, and I bet there are already plenty of
> > >> inconsistencies, minimizing the value captured via COBALT_SYSCALL
> > >> massively. So we should either get rid of cobalt_sysmodes or of that
> > >> parameter.
> > >>
> > > 
> > > "currently" is the point. If you feel implementing either aspects, i.e.
> > > automatic tagging of the current context when traversing a cobalt call
> > > based on the mode in the syscall macro, or generating the table data
> > > based on the info, please do. If you feel fixing any consistency between
> > > the two mode specs proving your bet right, please do as well. But for
> > > now, I won't pick that commit.
> > 
> > The approach of using COBALT_SYSCALL to define the mode only works if
> > that is also the only place to define it. Let's see first if/how that
> > can be achieved.
> 
> That can be achieved by getting the macro to adding data in a
> special section, then use that section as the syscall table with

Use that section to build the syscall table. Or sort it. The section
can not be used directoy, the syscalls are not in the right order.

-- 
					    Gilles.
https://click-hack.org


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
  2015-07-02 16:56           ` Philippe Gerum
@ 2015-07-02 17:03             ` Gilles Chanteperdrix
  2015-07-02 17:09               ` Philippe Gerum
  0 siblings, 1 reply; 28+ messages in thread
From: Gilles Chanteperdrix @ 2015-07-02 17:03 UTC (permalink / raw)
  To: Philippe Gerum; +Cc: Jan Kiszka, xenomai

On Thu, Jul 02, 2015 at 06:56:00PM +0200, Philippe Gerum wrote:
> On 07/02/2015 06:49 PM, Gilles Chanteperdrix wrote:
> > On Thu, Jul 02, 2015 at 06:44:06PM +0200, Jan Kiszka wrote:
> >> On 2015-07-02 18:30, Philippe Gerum wrote:
> >>> On 07/02/2015 05:39 PM, Jan Kiszka wrote:
> >>>> On 2015-07-02 17:24, Philippe Gerum wrote:
> >>>>> On 07/02/2015 05:20 PM, git repository hosting wrote:
> >>>>>> Module: xenomai-jki
> >>>>>> Branch: for-forge
> >>>>>> Commit: 99736c29a21a5e5536f8db9e580fd11cdb0eb0f2
> >>>>>> URL:    http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=99736c29a21a5e5536f8db9e580fd11cdb0eb0f2
> >>>>>>
> >>>>>> Author: Jan Kiszka <jan.kiszka@siemens.com>
> >>>>>> Date:   Thu Jul  2 17:12:39 2015 +0200
> >>>>>>
> >>>>>> cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
> >>>>>
> >>>>> We want to keep this. At some point, maybe, we will be able to use this
> >>>>> information to instrument the code with calling context guards, or as
> >>>>> the source of the mode data in the syscall table. Today, it's at least
> >>>>> useful inline documentation, without having to browse the table.
> >>>>
> >>>> This only makes sense when cobalt_sysmodes can be generated from it.
> >>>> Currently it isn't, and I bet there are already plenty of
> >>>> inconsistencies, minimizing the value captured via COBALT_SYSCALL
> >>>> massively. So we should either get rid of cobalt_sysmodes or of that
> >>>> parameter.
> >>>>
> >>>
> >>> "currently" is the point. If you feel implementing either aspects, i.e.
> >>> automatic tagging of the current context when traversing a cobalt call
> >>> based on the mode in the syscall macro, or generating the table data
> >>> based on the info, please do. If you feel fixing any consistency between
> >>> the two mode specs proving your bet right, please do as well. But for
> >>> now, I won't pick that commit.
> >>
> >> The approach of using COBALT_SYSCALL to define the mode only works if
> >> that is also the only place to define it. Let's see first if/how that
> >> can be achieved.
> > 
> > That can be achieved by getting the macro to adding data in a
> > special section, then use that section as the syscall table with
> > linker generate symbols. A lot of stuff works like this, like the
> > init table, or glibc constructors, so, this can definitely be
> > achieved. This probably requires the I-pipe patch to modify the
> > kernel linker script, of which there are several instances (one
> > instance by arch maybe).
> > 
> 
> Yes. Having to fixup the linker script was the reason not to implement
> this immediately, as there could be some backward compat issues to
> address with legacy pipelines running a most recent 3x cobalt core.

The linker script uses wildcards, maybe we can use a section name in
that namespace to avoid changing the script.

-- 
					    Gilles.
https://click-hack.org


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
  2015-07-02 17:03             ` Gilles Chanteperdrix
@ 2015-07-02 17:09               ` Philippe Gerum
  0 siblings, 0 replies; 28+ messages in thread
From: Philippe Gerum @ 2015-07-02 17:09 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: Jan Kiszka, xenomai

On 07/02/2015 07:03 PM, Gilles Chanteperdrix wrote:
> On Thu, Jul 02, 2015 at 06:56:00PM +0200, Philippe Gerum wrote:
>> On 07/02/2015 06:49 PM, Gilles Chanteperdrix wrote:
>>> On Thu, Jul 02, 2015 at 06:44:06PM +0200, Jan Kiszka wrote:
>>>> On 2015-07-02 18:30, Philippe Gerum wrote:
>>>>> On 07/02/2015 05:39 PM, Jan Kiszka wrote:
>>>>>> On 2015-07-02 17:24, Philippe Gerum wrote:
>>>>>>> On 07/02/2015 05:20 PM, git repository hosting wrote:
>>>>>>>> Module: xenomai-jki
>>>>>>>> Branch: for-forge
>>>>>>>> Commit: 99736c29a21a5e5536f8db9e580fd11cdb0eb0f2
>>>>>>>> URL:    http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=99736c29a21a5e5536f8db9e580fd11cdb0eb0f2
>>>>>>>>
>>>>>>>> Author: Jan Kiszka <jan.kiszka@siemens.com>
>>>>>>>> Date:   Thu Jul  2 17:12:39 2015 +0200
>>>>>>>>
>>>>>>>> cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
>>>>>>>
>>>>>>> We want to keep this. At some point, maybe, we will be able to use this
>>>>>>> information to instrument the code with calling context guards, or as
>>>>>>> the source of the mode data in the syscall table. Today, it's at least
>>>>>>> useful inline documentation, without having to browse the table.
>>>>>>
>>>>>> This only makes sense when cobalt_sysmodes can be generated from it.
>>>>>> Currently it isn't, and I bet there are already plenty of
>>>>>> inconsistencies, minimizing the value captured via COBALT_SYSCALL
>>>>>> massively. So we should either get rid of cobalt_sysmodes or of that
>>>>>> parameter.
>>>>>>
>>>>>
>>>>> "currently" is the point. If you feel implementing either aspects, i.e.
>>>>> automatic tagging of the current context when traversing a cobalt call
>>>>> based on the mode in the syscall macro, or generating the table data
>>>>> based on the info, please do. If you feel fixing any consistency between
>>>>> the two mode specs proving your bet right, please do as well. But for
>>>>> now, I won't pick that commit.
>>>>
>>>> The approach of using COBALT_SYSCALL to define the mode only works if
>>>> that is also the only place to define it. Let's see first if/how that
>>>> can be achieved.
>>>
>>> That can be achieved by getting the macro to adding data in a
>>> special section, then use that section as the syscall table with
>>> linker generate symbols. A lot of stuff works like this, like the
>>> init table, or glibc constructors, so, this can definitely be
>>> achieved. This probably requires the I-pipe patch to modify the
>>> kernel linker script, of which there are several instances (one
>>> instance by arch maybe).
>>>
>>
>> Yes. Having to fixup the linker script was the reason not to implement
>> this immediately, as there could be some backward compat issues to
>> address with legacy pipelines running a most recent 3x cobalt core.
> 
> The linker script uses wildcards, maybe we can use a section name in
> that namespace to avoid changing the script.
> 

I was referring to the Xenomai side, properly handling kernels patched
with pipelines supporting the feature or not.

-- 
Philippe.


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
  2015-07-02 16:56           ` Gilles Chanteperdrix
@ 2015-07-02 17:31             ` Jan Kiszka
  2015-07-02 17:35               ` Gilles Chanteperdrix
  0 siblings, 1 reply; 28+ messages in thread
From: Jan Kiszka @ 2015-07-02 17:31 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai

On 2015-07-02 18:56, Gilles Chanteperdrix wrote:
> On Thu, Jul 02, 2015 at 06:49:33PM +0200, Gilles Chanteperdrix wrote:
>> On Thu, Jul 02, 2015 at 06:44:06PM +0200, Jan Kiszka wrote:
>>> On 2015-07-02 18:30, Philippe Gerum wrote:
>>>> On 07/02/2015 05:39 PM, Jan Kiszka wrote:
>>>>> On 2015-07-02 17:24, Philippe Gerum wrote:
>>>>>> On 07/02/2015 05:20 PM, git repository hosting wrote:
>>>>>>> Module: xenomai-jki
>>>>>>> Branch: for-forge
>>>>>>> Commit: 99736c29a21a5e5536f8db9e580fd11cdb0eb0f2
>>>>>>> URL:    http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=99736c29a21a5e5536f8db9e580fd11cdb0eb0f2
>>>>>>>
>>>>>>> Author: Jan Kiszka <jan.kiszka@siemens.com>
>>>>>>> Date:   Thu Jul  2 17:12:39 2015 +0200
>>>>>>>
>>>>>>> cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
>>>>>>
>>>>>> We want to keep this. At some point, maybe, we will be able to use this
>>>>>> information to instrument the code with calling context guards, or as
>>>>>> the source of the mode data in the syscall table. Today, it's at least
>>>>>> useful inline documentation, without having to browse the table.
>>>>>
>>>>> This only makes sense when cobalt_sysmodes can be generated from it.
>>>>> Currently it isn't, and I bet there are already plenty of
>>>>> inconsistencies, minimizing the value captured via COBALT_SYSCALL
>>>>> massively. So we should either get rid of cobalt_sysmodes or of that
>>>>> parameter.
>>>>>
>>>>
>>>> "currently" is the point. If you feel implementing either aspects, i.e.
>>>> automatic tagging of the current context when traversing a cobalt call
>>>> based on the mode in the syscall macro, or generating the table data
>>>> based on the info, please do. If you feel fixing any consistency between
>>>> the two mode specs proving your bet right, please do as well. But for
>>>> now, I won't pick that commit.
>>>
>>> The approach of using COBALT_SYSCALL to define the mode only works if
>>> that is also the only place to define it. Let's see first if/how that
>>> can be achieved.
>>
>> That can be achieved by getting the macro to adding data in a
>> special section, then use that section as the syscall table with
> 
> Use that section to build the syscall table. Or sort it. The section
> can not be used directoy, the syscalls are not in the right order.

What would be the key for sorting? Semantically the syscall number, but
how to translate that into a key (i.e. a symbol name) that the linker
could sort properly?

As far as I can see for x86, the kernel uses a host script to generate
the syscall table which is defined arch/x86/syscalls/syscall_*.tbl -
presorted. That step also generates the #defines for the syscall numbers.

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
  2015-07-02 17:31             ` Jan Kiszka
@ 2015-07-02 17:35               ` Gilles Chanteperdrix
  2015-07-02 17:55                 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 28+ messages in thread
From: Gilles Chanteperdrix @ 2015-07-02 17:35 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai

On Thu, Jul 02, 2015 at 07:31:38PM +0200, Jan Kiszka wrote:
> On 2015-07-02 18:56, Gilles Chanteperdrix wrote:
> > On Thu, Jul 02, 2015 at 06:49:33PM +0200, Gilles Chanteperdrix wrote:
> >> On Thu, Jul 02, 2015 at 06:44:06PM +0200, Jan Kiszka wrote:
> >>> On 2015-07-02 18:30, Philippe Gerum wrote:
> >>>> On 07/02/2015 05:39 PM, Jan Kiszka wrote:
> >>>>> On 2015-07-02 17:24, Philippe Gerum wrote:
> >>>>>> On 07/02/2015 05:20 PM, git repository hosting wrote:
> >>>>>>> Module: xenomai-jki
> >>>>>>> Branch: for-forge
> >>>>>>> Commit: 99736c29a21a5e5536f8db9e580fd11cdb0eb0f2
> >>>>>>> URL:    http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=99736c29a21a5e5536f8db9e580fd11cdb0eb0f2
> >>>>>>>
> >>>>>>> Author: Jan Kiszka <jan.kiszka@siemens.com>
> >>>>>>> Date:   Thu Jul  2 17:12:39 2015 +0200
> >>>>>>>
> >>>>>>> cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
> >>>>>>
> >>>>>> We want to keep this. At some point, maybe, we will be able to use this
> >>>>>> information to instrument the code with calling context guards, or as
> >>>>>> the source of the mode data in the syscall table. Today, it's at least
> >>>>>> useful inline documentation, without having to browse the table.
> >>>>>
> >>>>> This only makes sense when cobalt_sysmodes can be generated from it.
> >>>>> Currently it isn't, and I bet there are already plenty of
> >>>>> inconsistencies, minimizing the value captured via COBALT_SYSCALL
> >>>>> massively. So we should either get rid of cobalt_sysmodes or of that
> >>>>> parameter.
> >>>>>
> >>>>
> >>>> "currently" is the point. If you feel implementing either aspects, i.e.
> >>>> automatic tagging of the current context when traversing a cobalt call
> >>>> based on the mode in the syscall macro, or generating the table data
> >>>> based on the info, please do. If you feel fixing any consistency between
> >>>> the two mode specs proving your bet right, please do as well. But for
> >>>> now, I won't pick that commit.
> >>>
> >>> The approach of using COBALT_SYSCALL to define the mode only works if
> >>> that is also the only place to define it. Let's see first if/how that
> >>> can be achieved.
> >>
> >> That can be achieved by getting the macro to adding data in a
> >> special section, then use that section as the syscall table with
> > 
> > Use that section to build the syscall table. Or sort it. The section
> > can not be used directoy, the syscalls are not in the right order.
> 
> What would be the key for sorting? Semantically the syscall number, but
> how to translate that into a key (i.e. a symbol name) that the linker
> could sort properly?
> 
> As far as I can see for x86, the kernel uses a host script to generate
> the syscall table which is defined arch/x86/syscalls/syscall_*.tbl -
> presorted. That step also generates the #defines for the syscall numbers.

Yes, we probably need to add the syscall number to the
COBALT_SYSCALL macro. Or build it from the function name. A second
possibility is to keep the current table, but do not fill the flag
field, and use the information in the section to find back each
syscall and fill the blanks.

-- 
					    Gilles.
https://click-hack.org


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
  2015-07-02 17:35               ` Gilles Chanteperdrix
@ 2015-07-02 17:55                 ` Gilles Chanteperdrix
  2015-07-02 17:57                   ` Jan Kiszka
  0 siblings, 1 reply; 28+ messages in thread
From: Gilles Chanteperdrix @ 2015-07-02 17:55 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai

On Thu, Jul 02, 2015 at 07:35:08PM +0200, Gilles Chanteperdrix wrote:
> On Thu, Jul 02, 2015 at 07:31:38PM +0200, Jan Kiszka wrote:
> > On 2015-07-02 18:56, Gilles Chanteperdrix wrote:
> > > On Thu, Jul 02, 2015 at 06:49:33PM +0200, Gilles Chanteperdrix wrote:
> > >> On Thu, Jul 02, 2015 at 06:44:06PM +0200, Jan Kiszka wrote:
> > >>> On 2015-07-02 18:30, Philippe Gerum wrote:
> > >>>> On 07/02/2015 05:39 PM, Jan Kiszka wrote:
> > >>>>> On 2015-07-02 17:24, Philippe Gerum wrote:
> > >>>>>> On 07/02/2015 05:20 PM, git repository hosting wrote:
> > >>>>>>> Module: xenomai-jki
> > >>>>>>> Branch: for-forge
> > >>>>>>> Commit: 99736c29a21a5e5536f8db9e580fd11cdb0eb0f2
> > >>>>>>> URL:    http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=99736c29a21a5e5536f8db9e580fd11cdb0eb0f2
> > >>>>>>>
> > >>>>>>> Author: Jan Kiszka <jan.kiszka@siemens.com>
> > >>>>>>> Date:   Thu Jul  2 17:12:39 2015 +0200
> > >>>>>>>
> > >>>>>>> cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
> > >>>>>>
> > >>>>>> We want to keep this. At some point, maybe, we will be able to use this
> > >>>>>> information to instrument the code with calling context guards, or as
> > >>>>>> the source of the mode data in the syscall table. Today, it's at least
> > >>>>>> useful inline documentation, without having to browse the table.
> > >>>>>
> > >>>>> This only makes sense when cobalt_sysmodes can be generated from it.
> > >>>>> Currently it isn't, and I bet there are already plenty of
> > >>>>> inconsistencies, minimizing the value captured via COBALT_SYSCALL
> > >>>>> massively. So we should either get rid of cobalt_sysmodes or of that
> > >>>>> parameter.
> > >>>>>
> > >>>>
> > >>>> "currently" is the point. If you feel implementing either aspects, i.e.
> > >>>> automatic tagging of the current context when traversing a cobalt call
> > >>>> based on the mode in the syscall macro, or generating the table data
> > >>>> based on the info, please do. If you feel fixing any consistency between
> > >>>> the two mode specs proving your bet right, please do as well. But for
> > >>>> now, I won't pick that commit.
> > >>>
> > >>> The approach of using COBALT_SYSCALL to define the mode only works if
> > >>> that is also the only place to define it. Let's see first if/how that
> > >>> can be achieved.
> > >>
> > >> That can be achieved by getting the macro to adding data in a
> > >> special section, then use that section as the syscall table with
> > > 
> > > Use that section to build the syscall table. Or sort it. The section
> > > can not be used directoy, the syscalls are not in the right order.
> > 
> > What would be the key for sorting? Semantically the syscall number, but
> > how to translate that into a key (i.e. a symbol name) that the linker
> > could sort properly?
> > 
> > As far as I can see for x86, the kernel uses a host script to generate
> > the syscall table which is defined arch/x86/syscalls/syscall_*.tbl -
> > presorted. That step also generates the #defines for the syscall numbers.
> 
> Yes, we probably need to add the syscall number to the
> COBALT_SYSCALL macro. Or build it from the function name. A second
> possibility is to keep the current table, but do not fill the flag
> field, and use the information in the section to find back each
> syscall and fill the blanks.

Yet another possibility is to run a script on the sources, which
generates the table as .c code. The script would simply handle the
calls to the COBALT_SYSCALL macro. This can be done with sed or awk
even. And this does not require playing with the linker script.

-- 
					    Gilles.
https://click-hack.org


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
  2015-07-02 17:55                 ` Gilles Chanteperdrix
@ 2015-07-02 17:57                   ` Jan Kiszka
  2015-07-02 18:00                     ` Gilles Chanteperdrix
  2015-07-02 18:42                     ` Gilles Chanteperdrix
  0 siblings, 2 replies; 28+ messages in thread
From: Jan Kiszka @ 2015-07-02 17:57 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai

On 2015-07-02 19:55, Gilles Chanteperdrix wrote:
> On Thu, Jul 02, 2015 at 07:35:08PM +0200, Gilles Chanteperdrix wrote:
>> On Thu, Jul 02, 2015 at 07:31:38PM +0200, Jan Kiszka wrote:
>>> On 2015-07-02 18:56, Gilles Chanteperdrix wrote:
>>>> On Thu, Jul 02, 2015 at 06:49:33PM +0200, Gilles Chanteperdrix wrote:
>>>>> On Thu, Jul 02, 2015 at 06:44:06PM +0200, Jan Kiszka wrote:
>>>>>> On 2015-07-02 18:30, Philippe Gerum wrote:
>>>>>>> On 07/02/2015 05:39 PM, Jan Kiszka wrote:
>>>>>>>> On 2015-07-02 17:24, Philippe Gerum wrote:
>>>>>>>>> On 07/02/2015 05:20 PM, git repository hosting wrote:
>>>>>>>>>> Module: xenomai-jki
>>>>>>>>>> Branch: for-forge
>>>>>>>>>> Commit: 99736c29a21a5e5536f8db9e580fd11cdb0eb0f2
>>>>>>>>>> URL:    http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=99736c29a21a5e5536f8db9e580fd11cdb0eb0f2
>>>>>>>>>>
>>>>>>>>>> Author: Jan Kiszka <jan.kiszka@siemens.com>
>>>>>>>>>> Date:   Thu Jul  2 17:12:39 2015 +0200
>>>>>>>>>>
>>>>>>>>>> cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
>>>>>>>>>
>>>>>>>>> We want to keep this. At some point, maybe, we will be able to use this
>>>>>>>>> information to instrument the code with calling context guards, or as
>>>>>>>>> the source of the mode data in the syscall table. Today, it's at least
>>>>>>>>> useful inline documentation, without having to browse the table.
>>>>>>>>
>>>>>>>> This only makes sense when cobalt_sysmodes can be generated from it.
>>>>>>>> Currently it isn't, and I bet there are already plenty of
>>>>>>>> inconsistencies, minimizing the value captured via COBALT_SYSCALL
>>>>>>>> massively. So we should either get rid of cobalt_sysmodes or of that
>>>>>>>> parameter.
>>>>>>>>
>>>>>>>
>>>>>>> "currently" is the point. If you feel implementing either aspects, i.e.
>>>>>>> automatic tagging of the current context when traversing a cobalt call
>>>>>>> based on the mode in the syscall macro, or generating the table data
>>>>>>> based on the info, please do. If you feel fixing any consistency between
>>>>>>> the two mode specs proving your bet right, please do as well. But for
>>>>>>> now, I won't pick that commit.
>>>>>>
>>>>>> The approach of using COBALT_SYSCALL to define the mode only works if
>>>>>> that is also the only place to define it. Let's see first if/how that
>>>>>> can be achieved.
>>>>>
>>>>> That can be achieved by getting the macro to adding data in a
>>>>> special section, then use that section as the syscall table with
>>>>
>>>> Use that section to build the syscall table. Or sort it. The section
>>>> can not be used directoy, the syscalls are not in the right order.
>>>
>>> What would be the key for sorting? Semantically the syscall number, but
>>> how to translate that into a key (i.e. a symbol name) that the linker
>>> could sort properly?
>>>
>>> As far as I can see for x86, the kernel uses a host script to generate
>>> the syscall table which is defined arch/x86/syscalls/syscall_*.tbl -
>>> presorted. That step also generates the #defines for the syscall numbers.
>>
>> Yes, we probably need to add the syscall number to the
>> COBALT_SYSCALL macro. Or build it from the function name. A second
>> possibility is to keep the current table, but do not fill the flag
>> field, and use the information in the section to find back each
>> syscall and fill the blanks.
> 
> Yet another possibility is to run a script on the sources, which
> generates the table as .c code. The script would simply handle the
> calls to the COBALT_SYSCALL macro. This can be done with sed or awk
> even. And this does not require playing with the linker script.

I more and more believe that is actually only feasible approach. The
linker tricks seem to fail because we cannot prepare the required input
as needed. If they worked, the kernel would surely use one of them.

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
  2015-07-02 17:57                   ` Jan Kiszka
@ 2015-07-02 18:00                     ` Gilles Chanteperdrix
  2015-07-02 18:42                     ` Gilles Chanteperdrix
  1 sibling, 0 replies; 28+ messages in thread
From: Gilles Chanteperdrix @ 2015-07-02 18:00 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai

On Thu, Jul 02, 2015 at 07:57:26PM +0200, Jan Kiszka wrote:
> On 2015-07-02 19:55, Gilles Chanteperdrix wrote:
> > On Thu, Jul 02, 2015 at 07:35:08PM +0200, Gilles Chanteperdrix wrote:
> >> On Thu, Jul 02, 2015 at 07:31:38PM +0200, Jan Kiszka wrote:
> >>> On 2015-07-02 18:56, Gilles Chanteperdrix wrote:
> >>>> On Thu, Jul 02, 2015 at 06:49:33PM +0200, Gilles Chanteperdrix wrote:
> >>>>> On Thu, Jul 02, 2015 at 06:44:06PM +0200, Jan Kiszka wrote:
> >>>>>> On 2015-07-02 18:30, Philippe Gerum wrote:
> >>>>>>> On 07/02/2015 05:39 PM, Jan Kiszka wrote:
> >>>>>>>> On 2015-07-02 17:24, Philippe Gerum wrote:
> >>>>>>>>> On 07/02/2015 05:20 PM, git repository hosting wrote:
> >>>>>>>>>> Module: xenomai-jki
> >>>>>>>>>> Branch: for-forge
> >>>>>>>>>> Commit: 99736c29a21a5e5536f8db9e580fd11cdb0eb0f2
> >>>>>>>>>> URL:    http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=99736c29a21a5e5536f8db9e580fd11cdb0eb0f2
> >>>>>>>>>>
> >>>>>>>>>> Author: Jan Kiszka <jan.kiszka@siemens.com>
> >>>>>>>>>> Date:   Thu Jul  2 17:12:39 2015 +0200
> >>>>>>>>>>
> >>>>>>>>>> cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
> >>>>>>>>>
> >>>>>>>>> We want to keep this. At some point, maybe, we will be able to use this
> >>>>>>>>> information to instrument the code with calling context guards, or as
> >>>>>>>>> the source of the mode data in the syscall table. Today, it's at least
> >>>>>>>>> useful inline documentation, without having to browse the table.
> >>>>>>>>
> >>>>>>>> This only makes sense when cobalt_sysmodes can be generated from it.
> >>>>>>>> Currently it isn't, and I bet there are already plenty of
> >>>>>>>> inconsistencies, minimizing the value captured via COBALT_SYSCALL
> >>>>>>>> massively. So we should either get rid of cobalt_sysmodes or of that
> >>>>>>>> parameter.
> >>>>>>>>
> >>>>>>>
> >>>>>>> "currently" is the point. If you feel implementing either aspects, i.e.
> >>>>>>> automatic tagging of the current context when traversing a cobalt call
> >>>>>>> based on the mode in the syscall macro, or generating the table data
> >>>>>>> based on the info, please do. If you feel fixing any consistency between
> >>>>>>> the two mode specs proving your bet right, please do as well. But for
> >>>>>>> now, I won't pick that commit.
> >>>>>>
> >>>>>> The approach of using COBALT_SYSCALL to define the mode only works if
> >>>>>> that is also the only place to define it. Let's see first if/how that
> >>>>>> can be achieved.
> >>>>>
> >>>>> That can be achieved by getting the macro to adding data in a
> >>>>> special section, then use that section as the syscall table with
> >>>>
> >>>> Use that section to build the syscall table. Or sort it. The section
> >>>> can not be used directoy, the syscalls are not in the right order.
> >>>
> >>> What would be the key for sorting? Semantically the syscall number, but
> >>> how to translate that into a key (i.e. a symbol name) that the linker
> >>> could sort properly?
> >>>
> >>> As far as I can see for x86, the kernel uses a host script to generate
> >>> the syscall table which is defined arch/x86/syscalls/syscall_*.tbl -
> >>> presorted. That step also generates the #defines for the syscall numbers.
> >>
> >> Yes, we probably need to add the syscall number to the
> >> COBALT_SYSCALL macro. Or build it from the function name. A second
> >> possibility is to keep the current table, but do not fill the flag
> >> field, and use the information in the section to find back each
> >> syscall and fill the blanks.
> > 
> > Yet another possibility is to run a script on the sources, which
> > generates the table as .c code. The script would simply handle the
> > calls to the COBALT_SYSCALL macro. This can be done with sed or awk
> > even. And this does not require playing with the linker script.
> 
> I more and more believe that is actually only feasible approach.
> linker tricks seem to fail because we cannot prepare the required input
> as needed.

No, as I said it can be done, but requires adding code to the linker
script. And this causes problem for handling I-pipe patches that
were released before we introduce the change to the linker script.

> If they worked, the kernel would surely use one of them.

That is BS, the kernel has chosen other solutions, that is all.

-- 
					    Gilles.
https://click-hack.org


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
  2015-07-02 17:57                   ` Jan Kiszka
  2015-07-02 18:00                     ` Gilles Chanteperdrix
@ 2015-07-02 18:42                     ` Gilles Chanteperdrix
  2015-07-02 18:49                       ` Jan Kiszka
  1 sibling, 1 reply; 28+ messages in thread
From: Gilles Chanteperdrix @ 2015-07-02 18:42 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai

On Thu, Jul 02, 2015 at 07:57:26PM +0200, Jan Kiszka wrote:
> On 2015-07-02 19:55, Gilles Chanteperdrix wrote:
> > On Thu, Jul 02, 2015 at 07:35:08PM +0200, Gilles Chanteperdrix wrote:
> >> On Thu, Jul 02, 2015 at 07:31:38PM +0200, Jan Kiszka wrote:
> >>> On 2015-07-02 18:56, Gilles Chanteperdrix wrote:
> >>>> On Thu, Jul 02, 2015 at 06:49:33PM +0200, Gilles Chanteperdrix wrote:
> >>>>> On Thu, Jul 02, 2015 at 06:44:06PM +0200, Jan Kiszka wrote:
> >>>>>> On 2015-07-02 18:30, Philippe Gerum wrote:
> >>>>>>> On 07/02/2015 05:39 PM, Jan Kiszka wrote:
> >>>>>>>> On 2015-07-02 17:24, Philippe Gerum wrote:
> >>>>>>>>> On 07/02/2015 05:20 PM, git repository hosting wrote:
> >>>>>>>>>> Module: xenomai-jki
> >>>>>>>>>> Branch: for-forge
> >>>>>>>>>> Commit: 99736c29a21a5e5536f8db9e580fd11cdb0eb0f2
> >>>>>>>>>> URL:    http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=99736c29a21a5e5536f8db9e580fd11cdb0eb0f2
> >>>>>>>>>>
> >>>>>>>>>> Author: Jan Kiszka <jan.kiszka@siemens.com>
> >>>>>>>>>> Date:   Thu Jul  2 17:12:39 2015 +0200
> >>>>>>>>>>
> >>>>>>>>>> cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
> >>>>>>>>>
> >>>>>>>>> We want to keep this. At some point, maybe, we will be able to use this
> >>>>>>>>> information to instrument the code with calling context guards, or as
> >>>>>>>>> the source of the mode data in the syscall table. Today, it's at least
> >>>>>>>>> useful inline documentation, without having to browse the table.
> >>>>>>>>
> >>>>>>>> This only makes sense when cobalt_sysmodes can be generated from it.
> >>>>>>>> Currently it isn't, and I bet there are already plenty of
> >>>>>>>> inconsistencies, minimizing the value captured via COBALT_SYSCALL
> >>>>>>>> massively. So we should either get rid of cobalt_sysmodes or of that
> >>>>>>>> parameter.
> >>>>>>>>
> >>>>>>>
> >>>>>>> "currently" is the point. If you feel implementing either aspects, i.e.
> >>>>>>> automatic tagging of the current context when traversing a cobalt call
> >>>>>>> based on the mode in the syscall macro, or generating the table data
> >>>>>>> based on the info, please do. If you feel fixing any consistency between
> >>>>>>> the two mode specs proving your bet right, please do as well. But for
> >>>>>>> now, I won't pick that commit.
> >>>>>>
> >>>>>> The approach of using COBALT_SYSCALL to define the mode only works if
> >>>>>> that is also the only place to define it. Let's see first if/how that
> >>>>>> can be achieved.
> >>>>>
> >>>>> That can be achieved by getting the macro to adding data in a
> >>>>> special section, then use that section as the syscall table with
> >>>>
> >>>> Use that section to build the syscall table. Or sort it. The section
> >>>> can not be used directoy, the syscalls are not in the right order.
> >>>
> >>> What would be the key for sorting? Semantically the syscall number, but
> >>> how to translate that into a key (i.e. a symbol name) that the linker
> >>> could sort properly?
> >>>
> >>> As far as I can see for x86, the kernel uses a host script to generate
> >>> the syscall table which is defined arch/x86/syscalls/syscall_*.tbl -
> >>> presorted. That step also generates the #defines for the syscall numbers.
> >>
> >> Yes, we probably need to add the syscall number to the
> >> COBALT_SYSCALL macro. Or build it from the function name. A second
> >> possibility is to keep the current table, but do not fill the flag
> >> field, and use the information in the section to find back each
> >> syscall and fill the blanks.
> > 
> > Yet another possibility is to run a script on the sources, which
> > generates the table as .c code. The script would simply handle the
> > calls to the COBALT_SYSCALL macro. This can be done with sed or awk
> > even. And this does not require playing with the linker script.
> 
> I more and more believe that is actually only feasible approach. The
> linker tricks seem to fail because we cannot prepare the required input
> as needed. If they worked, the kernel would surely use one of them.

Actually the awk script is astonishingly simple.

find kernel/cobalt -name '*.c' | xargs cat | awk -f foo.awk

With foo.awk

match($0, /COBALT_SYSCALL\([^,]*, [^,]*/)  {
	str=substr($0, RSTART + 15, RLENGTH - 15)
	match(str, /[^,]*/)
	syscall=substr(str, RSTART, RLENGTH)
	seen[syscall]=1;
	print "__COBALT_MODE(" str "),"
}

match($0, /__COBALT_CALL_ENTRY\([^)]*/)  {
	syscall=substr($0, RSTART + 20, RLENGTH - 20)
	intable[syscall]=1
}

END {
	for (s in intable)  {
		if (s != "" && s != "__name" && !seen[s])
			print "missed syscall \"" s "\" implementation!"
	}
}

The problem will be to re-run the script when a new syscall is added
or a file is modified.

-- 
					    Gilles.
https://click-hack.org


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
  2015-07-02 18:42                     ` Gilles Chanteperdrix
@ 2015-07-02 18:49                       ` Jan Kiszka
  2015-07-02 18:55                         ` Gilles Chanteperdrix
  0 siblings, 1 reply; 28+ messages in thread
From: Jan Kiszka @ 2015-07-02 18:49 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai

On 2015-07-02 20:42, Gilles Chanteperdrix wrote:
> On Thu, Jul 02, 2015 at 07:57:26PM +0200, Jan Kiszka wrote:
>> On 2015-07-02 19:55, Gilles Chanteperdrix wrote:
>>> On Thu, Jul 02, 2015 at 07:35:08PM +0200, Gilles Chanteperdrix wrote:
>>>> On Thu, Jul 02, 2015 at 07:31:38PM +0200, Jan Kiszka wrote:
>>>>> On 2015-07-02 18:56, Gilles Chanteperdrix wrote:
>>>>>> On Thu, Jul 02, 2015 at 06:49:33PM +0200, Gilles Chanteperdrix wrote:
>>>>>>> On Thu, Jul 02, 2015 at 06:44:06PM +0200, Jan Kiszka wrote:
>>>>>>>> On 2015-07-02 18:30, Philippe Gerum wrote:
>>>>>>>>> On 07/02/2015 05:39 PM, Jan Kiszka wrote:
>>>>>>>>>> On 2015-07-02 17:24, Philippe Gerum wrote:
>>>>>>>>>>> On 07/02/2015 05:20 PM, git repository hosting wrote:
>>>>>>>>>>>> Module: xenomai-jki
>>>>>>>>>>>> Branch: for-forge
>>>>>>>>>>>> Commit: 99736c29a21a5e5536f8db9e580fd11cdb0eb0f2
>>>>>>>>>>>> URL:    http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=99736c29a21a5e5536f8db9e580fd11cdb0eb0f2
>>>>>>>>>>>>
>>>>>>>>>>>> Author: Jan Kiszka <jan.kiszka@siemens.com>
>>>>>>>>>>>> Date:   Thu Jul  2 17:12:39 2015 +0200
>>>>>>>>>>>>
>>>>>>>>>>>> cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
>>>>>>>>>>>
>>>>>>>>>>> We want to keep this. At some point, maybe, we will be able to use this
>>>>>>>>>>> information to instrument the code with calling context guards, or as
>>>>>>>>>>> the source of the mode data in the syscall table. Today, it's at least
>>>>>>>>>>> useful inline documentation, without having to browse the table.
>>>>>>>>>>
>>>>>>>>>> This only makes sense when cobalt_sysmodes can be generated from it.
>>>>>>>>>> Currently it isn't, and I bet there are already plenty of
>>>>>>>>>> inconsistencies, minimizing the value captured via COBALT_SYSCALL
>>>>>>>>>> massively. So we should either get rid of cobalt_sysmodes or of that
>>>>>>>>>> parameter.
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> "currently" is the point. If you feel implementing either aspects, i.e.
>>>>>>>>> automatic tagging of the current context when traversing a cobalt call
>>>>>>>>> based on the mode in the syscall macro, or generating the table data
>>>>>>>>> based on the info, please do. If you feel fixing any consistency between
>>>>>>>>> the two mode specs proving your bet right, please do as well. But for
>>>>>>>>> now, I won't pick that commit.
>>>>>>>>
>>>>>>>> The approach of using COBALT_SYSCALL to define the mode only works if
>>>>>>>> that is also the only place to define it. Let's see first if/how that
>>>>>>>> can be achieved.
>>>>>>>
>>>>>>> That can be achieved by getting the macro to adding data in a
>>>>>>> special section, then use that section as the syscall table with
>>>>>>
>>>>>> Use that section to build the syscall table. Or sort it. The section
>>>>>> can not be used directoy, the syscalls are not in the right order.
>>>>>
>>>>> What would be the key for sorting? Semantically the syscall number, but
>>>>> how to translate that into a key (i.e. a symbol name) that the linker
>>>>> could sort properly?
>>>>>
>>>>> As far as I can see for x86, the kernel uses a host script to generate
>>>>> the syscall table which is defined arch/x86/syscalls/syscall_*.tbl -
>>>>> presorted. That step also generates the #defines for the syscall numbers.
>>>>
>>>> Yes, we probably need to add the syscall number to the
>>>> COBALT_SYSCALL macro. Or build it from the function name. A second
>>>> possibility is to keep the current table, but do not fill the flag
>>>> field, and use the information in the section to find back each
>>>> syscall and fill the blanks.
>>>
>>> Yet another possibility is to run a script on the sources, which
>>> generates the table as .c code. The script would simply handle the
>>> calls to the COBALT_SYSCALL macro. This can be done with sed or awk
>>> even. And this does not require playing with the linker script.
>>
>> I more and more believe that is actually only feasible approach. The
>> linker tricks seem to fail because we cannot prepare the required input
>> as needed. If they worked, the kernel would surely use one of them.
> 
> Actually the awk script is astonishingly simple.
> 
> find kernel/cobalt -name '*.c' | xargs cat | awk -f foo.awk
> 
> With foo.awk
> 
> match($0, /COBALT_SYSCALL\([^,]*, [^,]*/)  {
> 	str=substr($0, RSTART + 15, RLENGTH - 15)
> 	match(str, /[^,]*/)
> 	syscall=substr(str, RSTART, RLENGTH)
> 	seen[syscall]=1;
> 	print "__COBALT_MODE(" str "),"
> }
> 
> match($0, /__COBALT_CALL_ENTRY\([^)]*/)  {
> 	syscall=substr($0, RSTART + 20, RLENGTH - 20)
> 	intable[syscall]=1
> }
> 
> END {
> 	for (s in intable)  {
> 		if (s != "" && s != "__name" && !seen[s])
> 			print "missed syscall \"" s "\" implementation!"
> 	}
> }

Ah, good that you have the right awk foo. I'll give this a try.

> 
> The problem will be to re-run the script when a new syscall is added
> or a file is modified.

That should be simple. Working on the Makefile bits...

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
  2015-07-02 18:49                       ` Jan Kiszka
@ 2015-07-02 18:55                         ` Gilles Chanteperdrix
  2015-07-02 19:32                           ` Jan Kiszka
  0 siblings, 1 reply; 28+ messages in thread
From: Gilles Chanteperdrix @ 2015-07-02 18:55 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai

On Thu, Jul 02, 2015 at 08:49:04PM +0200, Jan Kiszka wrote:
> On 2015-07-02 20:42, Gilles Chanteperdrix wrote:
> > On Thu, Jul 02, 2015 at 07:57:26PM +0200, Jan Kiszka wrote:
> >> On 2015-07-02 19:55, Gilles Chanteperdrix wrote:
> >>> On Thu, Jul 02, 2015 at 07:35:08PM +0200, Gilles Chanteperdrix wrote:
> >>>> On Thu, Jul 02, 2015 at 07:31:38PM +0200, Jan Kiszka wrote:
> >>>>> On 2015-07-02 18:56, Gilles Chanteperdrix wrote:
> >>>>>> On Thu, Jul 02, 2015 at 06:49:33PM +0200, Gilles Chanteperdrix wrote:
> >>>>>>> On Thu, Jul 02, 2015 at 06:44:06PM +0200, Jan Kiszka wrote:
> >>>>>>>> On 2015-07-02 18:30, Philippe Gerum wrote:
> >>>>>>>>> On 07/02/2015 05:39 PM, Jan Kiszka wrote:
> >>>>>>>>>> On 2015-07-02 17:24, Philippe Gerum wrote:
> >>>>>>>>>>> On 07/02/2015 05:20 PM, git repository hosting wrote:
> >>>>>>>>>>>> Module: xenomai-jki
> >>>>>>>>>>>> Branch: for-forge
> >>>>>>>>>>>> Commit: 99736c29a21a5e5536f8db9e580fd11cdb0eb0f2
> >>>>>>>>>>>> URL:    http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=99736c29a21a5e5536f8db9e580fd11cdb0eb0f2
> >>>>>>>>>>>>
> >>>>>>>>>>>> Author: Jan Kiszka <jan.kiszka@siemens.com>
> >>>>>>>>>>>> Date:   Thu Jul  2 17:12:39 2015 +0200
> >>>>>>>>>>>>
> >>>>>>>>>>>> cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
> >>>>>>>>>>>
> >>>>>>>>>>> We want to keep this. At some point, maybe, we will be able to use this
> >>>>>>>>>>> information to instrument the code with calling context guards, or as
> >>>>>>>>>>> the source of the mode data in the syscall table. Today, it's at least
> >>>>>>>>>>> useful inline documentation, without having to browse the table.
> >>>>>>>>>>
> >>>>>>>>>> This only makes sense when cobalt_sysmodes can be generated from it.
> >>>>>>>>>> Currently it isn't, and I bet there are already plenty of
> >>>>>>>>>> inconsistencies, minimizing the value captured via COBALT_SYSCALL
> >>>>>>>>>> massively. So we should either get rid of cobalt_sysmodes or of that
> >>>>>>>>>> parameter.
> >>>>>>>>>>
> >>>>>>>>>
> >>>>>>>>> "currently" is the point. If you feel implementing either aspects, i.e.
> >>>>>>>>> automatic tagging of the current context when traversing a cobalt call
> >>>>>>>>> based on the mode in the syscall macro, or generating the table data
> >>>>>>>>> based on the info, please do. If you feel fixing any consistency between
> >>>>>>>>> the two mode specs proving your bet right, please do as well. But for
> >>>>>>>>> now, I won't pick that commit.
> >>>>>>>>
> >>>>>>>> The approach of using COBALT_SYSCALL to define the mode only works if
> >>>>>>>> that is also the only place to define it. Let's see first if/how that
> >>>>>>>> can be achieved.
> >>>>>>>
> >>>>>>> That can be achieved by getting the macro to adding data in a
> >>>>>>> special section, then use that section as the syscall table with
> >>>>>>
> >>>>>> Use that section to build the syscall table. Or sort it. The section
> >>>>>> can not be used directoy, the syscalls are not in the right order.
> >>>>>
> >>>>> What would be the key for sorting? Semantically the syscall number, but
> >>>>> how to translate that into a key (i.e. a symbol name) that the linker
> >>>>> could sort properly?
> >>>>>
> >>>>> As far as I can see for x86, the kernel uses a host script to generate
> >>>>> the syscall table which is defined arch/x86/syscalls/syscall_*.tbl -
> >>>>> presorted. That step also generates the #defines for the syscall numbers.
> >>>>
> >>>> Yes, we probably need to add the syscall number to the
> >>>> COBALT_SYSCALL macro. Or build it from the function name. A second
> >>>> possibility is to keep the current table, but do not fill the flag
> >>>> field, and use the information in the section to find back each
> >>>> syscall and fill the blanks.
> >>>
> >>> Yet another possibility is to run a script on the sources, which
> >>> generates the table as .c code. The script would simply handle the
> >>> calls to the COBALT_SYSCALL macro. This can be done with sed or awk
> >>> even. And this does not require playing with the linker script.
> >>
> >> I more and more believe that is actually only feasible approach. The
> >> linker tricks seem to fail because we cannot prepare the required input
> >> as needed. If they worked, the kernel would surely use one of them.
> > 
> > Actually the awk script is astonishingly simple.
> > 
> > find kernel/cobalt -name '*.c' | xargs cat | awk -f foo.awk
> > 
> > With foo.awk
> > 
> > match($0, /COBALT_SYSCALL\([^,]*, [^,]*/)  {
> > 	str=substr($0, RSTART + 15, RLENGTH - 15)
> > 	match(str, /[^,]*/)
> > 	syscall=substr(str, RSTART, RLENGTH)
> > 	seen[syscall]=1;
> > 	print "__COBALT_MODE(" str "),"
> > }
> > 
> > match($0, /__COBALT_CALL_ENTRY\([^)]*/)  {
> > 	syscall=substr($0, RSTART + 20, RLENGTH - 20)
> > 	intable[syscall]=1
> > }
> > 
> > END {
> > 	for (s in intable)  {
> > 		if (s != "" && s != "__name" && !seen[s])
> > 			print "missed syscall \"" s "\" implementation!"
> > 	}
> > }
> 
> Ah, good that you have the right awk foo. I'll give this a try.

Ok, the script issues a list of __COBALT_MODE statements which
replaces the contents of the cobalt_sysmodes table. You probably want
to exit 1 when we missed a COBALT_SYSCALL declaration. We could just
as easily generate the contents of the cobalt_syscalls table, but in
that case, if the script misses a COBALT_SYSCALL declaration, we
have no way of knowing.

> 
> > 
> > The problem will be to re-run the script when a new syscall is added
> > or a file is modified.
> 
> That should be simple. Working on the Makefile bits...

Actually, the only way I see is to regenerate the table at every
compilation.

-- 
					    Gilles.
https://click-hack.org


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
  2015-07-02 18:55                         ` Gilles Chanteperdrix
@ 2015-07-02 19:32                           ` Jan Kiszka
  2015-07-02 20:26                             ` Jan Kiszka
  0 siblings, 1 reply; 28+ messages in thread
From: Jan Kiszka @ 2015-07-02 19:32 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai

On 2015-07-02 20:55, Gilles Chanteperdrix wrote:
> On Thu, Jul 02, 2015 at 08:49:04PM +0200, Jan Kiszka wrote:
>> On 2015-07-02 20:42, Gilles Chanteperdrix wrote:
>>> On Thu, Jul 02, 2015 at 07:57:26PM +0200, Jan Kiszka wrote:
>>>> On 2015-07-02 19:55, Gilles Chanteperdrix wrote:
>>>>> On Thu, Jul 02, 2015 at 07:35:08PM +0200, Gilles Chanteperdrix wrote:
>>>>>> On Thu, Jul 02, 2015 at 07:31:38PM +0200, Jan Kiszka wrote:
>>>>>>> On 2015-07-02 18:56, Gilles Chanteperdrix wrote:
>>>>>>>> On Thu, Jul 02, 2015 at 06:49:33PM +0200, Gilles Chanteperdrix wrote:
>>>>>>>>> On Thu, Jul 02, 2015 at 06:44:06PM +0200, Jan Kiszka wrote:
>>>>>>>>>> On 2015-07-02 18:30, Philippe Gerum wrote:
>>>>>>>>>>> On 07/02/2015 05:39 PM, Jan Kiszka wrote:
>>>>>>>>>>>> On 2015-07-02 17:24, Philippe Gerum wrote:
>>>>>>>>>>>>> On 07/02/2015 05:20 PM, git repository hosting wrote:
>>>>>>>>>>>>>> Module: xenomai-jki
>>>>>>>>>>>>>> Branch: for-forge
>>>>>>>>>>>>>> Commit: 99736c29a21a5e5536f8db9e580fd11cdb0eb0f2
>>>>>>>>>>>>>> URL:    http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=99736c29a21a5e5536f8db9e580fd11cdb0eb0f2
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Author: Jan Kiszka <jan.kiszka@siemens.com>
>>>>>>>>>>>>>> Date:   Thu Jul  2 17:12:39 2015 +0200
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
>>>>>>>>>>>>>
>>>>>>>>>>>>> We want to keep this. At some point, maybe, we will be able to use this
>>>>>>>>>>>>> information to instrument the code with calling context guards, or as
>>>>>>>>>>>>> the source of the mode data in the syscall table. Today, it's at least
>>>>>>>>>>>>> useful inline documentation, without having to browse the table.
>>>>>>>>>>>>
>>>>>>>>>>>> This only makes sense when cobalt_sysmodes can be generated from it.
>>>>>>>>>>>> Currently it isn't, and I bet there are already plenty of
>>>>>>>>>>>> inconsistencies, minimizing the value captured via COBALT_SYSCALL
>>>>>>>>>>>> massively. So we should either get rid of cobalt_sysmodes or of that
>>>>>>>>>>>> parameter.
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> "currently" is the point. If you feel implementing either aspects, i.e.
>>>>>>>>>>> automatic tagging of the current context when traversing a cobalt call
>>>>>>>>>>> based on the mode in the syscall macro, or generating the table data
>>>>>>>>>>> based on the info, please do. If you feel fixing any consistency between
>>>>>>>>>>> the two mode specs proving your bet right, please do as well. But for
>>>>>>>>>>> now, I won't pick that commit.
>>>>>>>>>>
>>>>>>>>>> The approach of using COBALT_SYSCALL to define the mode only works if
>>>>>>>>>> that is also the only place to define it. Let's see first if/how that
>>>>>>>>>> can be achieved.
>>>>>>>>>
>>>>>>>>> That can be achieved by getting the macro to adding data in a
>>>>>>>>> special section, then use that section as the syscall table with
>>>>>>>>
>>>>>>>> Use that section to build the syscall table. Or sort it. The section
>>>>>>>> can not be used directoy, the syscalls are not in the right order.
>>>>>>>
>>>>>>> What would be the key for sorting? Semantically the syscall number, but
>>>>>>> how to translate that into a key (i.e. a symbol name) that the linker
>>>>>>> could sort properly?
>>>>>>>
>>>>>>> As far as I can see for x86, the kernel uses a host script to generate
>>>>>>> the syscall table which is defined arch/x86/syscalls/syscall_*.tbl -
>>>>>>> presorted. That step also generates the #defines for the syscall numbers.
>>>>>>
>>>>>> Yes, we probably need to add the syscall number to the
>>>>>> COBALT_SYSCALL macro. Or build it from the function name. A second
>>>>>> possibility is to keep the current table, but do not fill the flag
>>>>>> field, and use the information in the section to find back each
>>>>>> syscall and fill the blanks.
>>>>>
>>>>> Yet another possibility is to run a script on the sources, which
>>>>> generates the table as .c code. The script would simply handle the
>>>>> calls to the COBALT_SYSCALL macro. This can be done with sed or awk
>>>>> even. And this does not require playing with the linker script.
>>>>
>>>> I more and more believe that is actually only feasible approach. The
>>>> linker tricks seem to fail because we cannot prepare the required input
>>>> as needed. If they worked, the kernel would surely use one of them.
>>>
>>> Actually the awk script is astonishingly simple.
>>>
>>> find kernel/cobalt -name '*.c' | xargs cat | awk -f foo.awk
>>>
>>> With foo.awk
>>>
>>> match($0, /COBALT_SYSCALL\([^,]*, [^,]*/)  {
>>> 	str=substr($0, RSTART + 15, RLENGTH - 15)
>>> 	match(str, /[^,]*/)
>>> 	syscall=substr(str, RSTART, RLENGTH)
>>> 	seen[syscall]=1;
>>> 	print "__COBALT_MODE(" str "),"
>>> }
>>>
>>> match($0, /__COBALT_CALL_ENTRY\([^)]*/)  {
>>> 	syscall=substr($0, RSTART + 20, RLENGTH - 20)
>>> 	intable[syscall]=1
>>> }
>>>
>>> END {
>>> 	for (s in intable)  {
>>> 		if (s != "" && s != "__name" && !seen[s])
>>> 			print "missed syscall \"" s "\" implementation!"
>>> 	}
>>> }
>>
>> Ah, good that you have the right awk foo. I'll give this a try.
> 
> Ok, the script issues a list of __COBALT_MODE statements which
> replaces the contents of the cobalt_sysmodes table. You probably want
> to exit 1 when we missed a COBALT_SYSCALL declaration. We could just
> as easily generate the contents of the cobalt_syscalls table, but in
> that case, if the script misses a COBALT_SYSCALL declaration, we
> have no way of knowing.

Well, if posix/*.c would be fine already for the search space, that's
working now.

> 
>>
>>>
>>> The problem will be to re-run the script when a new syscall is added
>>> or a file is modified.
>>
>> That should be simple. Working on the Makefile bits...
> 
> Actually, the only way I see is to regenerate the table at every
> compilation.

Two options:
- Let the generation depend on all relevant input files, then it will
  only be updated on changes, but possibly even of files that do not
  include syscalls.
- Build the table on every run, but check if the result changed. Only
  then update the file that will be included for builds.

Maybe one can combine both, haven't tried yet. Currently working with
the first option.

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
  2015-07-02 19:32                           ` Jan Kiszka
@ 2015-07-02 20:26                             ` Jan Kiszka
  2015-07-03 10:51                               ` Gilles Chanteperdrix
  0 siblings, 1 reply; 28+ messages in thread
From: Jan Kiszka @ 2015-07-02 20:26 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai

Just FYI - still requires testing and more review - find a first
generator version below.

Jan


cobalt/posix/syscall: Generate cobalt_syscalls and cobalt_sysmodes

---
 .../arch/x86/include/asm/xenomai/syscall32.h       |  12 +-
 kernel/cobalt/posix/Makefile                       |  12 ++
 kernel/cobalt/posix/gen-syscall-entries.sh         |  24 +++
 kernel/cobalt/posix/syscall.c                      | 208 ++-------------------
 scripts/prepare-kernel.sh                          |   4 +-
 5 files changed, 57 insertions(+), 203 deletions(-)
 create mode 100755 kernel/cobalt/posix/gen-syscall-entries.sh

diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h
index 8bd40d4..58b7336 100644
--- a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h
+++ b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h
@@ -45,14 +45,14 @@
 #define __syshand32x__(__name)	((cobalt_syshand)(cobalt32x_ ## __name))
 
 #define __COBALT_CALL32x_INITHAND(__handler)	\
-  , [__COBALT_X32_BASE ... __COBALT_X32_BASE + __NR_COBALT_SYSCALLS-1] = __handler
+	[__COBALT_X32_BASE ... __COBALT_X32_BASE + __NR_COBALT_SYSCALLS-1] = __handler,
 
 #define __COBALT_CALL32x_INITMODE(__mode)	\
-  , [__COBALT_X32_BASE ... __COBALT_X32_BASE + __NR_COBALT_SYSCALLS-1] = __mode
+	[__COBALT_X32_BASE ... __COBALT_X32_BASE + __NR_COBALT_SYSCALLS-1] = __mode,
 
 /* x32 default entry (no thunk) */
 #define __COBALT_CALL32x_ENTRY(__name, __handler)		\
-	, [sc_cobalt_ ## __name + __COBALT_X32_BASE] = __handler
+	[sc_cobalt_ ## __name + __COBALT_X32_BASE] = __handler,
 
 /* x32 thunk installation */
 #define __COBALT_CALL32x_pure_THUNK(__name)	\
@@ -113,14 +113,14 @@
 #define __syshand32emu__(__name)	((cobalt_syshand)(cobalt32emu_ ## __name))
 
 #define __COBALT_CALL32emu_INITHAND(__handler)	\
-  , [__COBALT_IA32_BASE ... __COBALT_IA32_BASE + __NR_COBALT_SYSCALLS-1] = __handler
+	[__COBALT_IA32_BASE ... __COBALT_IA32_BASE + __NR_COBALT_SYSCALLS-1] = __handler,
 
 #define __COBALT_CALL32emu_INITMODE(__mode)	\
-  , [__COBALT_IA32_BASE ... __COBALT_IA32_BASE + __NR_COBALT_SYSCALLS-1] = __mode
+	[__COBALT_IA32_BASE ... __COBALT_IA32_BASE + __NR_COBALT_SYSCALLS-1] = __mode,
 
 /* ia32 default entry (no thunk) */
 #define __COBALT_CALL32emu_ENTRY(__name, __handler)		\
-	, [sc_cobalt_ ## __name + __COBALT_IA32_BASE] = __handler
+	[sc_cobalt_ ## __name + __COBALT_IA32_BASE] = __handler,
 
 /* ia32 thunk installation */
 #define __COBALT_CALL32emu_THUNK(__name)	\
diff --git a/kernel/cobalt/posix/Makefile b/kernel/cobalt/posix/Makefile
index 3049be4..2da764a 100644
--- a/kernel/cobalt/posix/Makefile
+++ b/kernel/cobalt/posix/Makefile
@@ -22,4 +22,16 @@ xenomai-y :=		\
 	timer.o		\
 	timerfd.o
 
+syscall_entries := $(srctree)/$(src)/gen-syscall-entries.sh
+
+quiet_cmd_syscall_entries = GEN     $@
+      cmd_syscall_entries = $(CONFIG_SHELL) '$(syscall_entries)' $^ > $@
+
+$(obj)/syscall_entries.h: $(syscall_entries) $(wildcard $(srctree)/$(src)/*.c)
+	$(call if_changed,syscall_entries)
+
+target += syscall_entries.h
+
+$(obj)/syscall.o: $(obj)/syscall_entries.h
+
 xenomai-$(CONFIG_XENO_ARCH_SYS3264) += compat.o syscall32.o
diff --git a/kernel/cobalt/posix/gen-syscall-entries.sh b/kernel/cobalt/posix/gen-syscall-entries.sh
new file mode 100755
index 0000000..36b1e69
--- /dev/null
+++ b/kernel/cobalt/posix/gen-syscall-entries.sh
@@ -0,0 +1,24 @@
+#! /bin/sh
+
+set -e
+
+shift
+
+echo "#ifdef COBALT_LIST_CALL_ENTRIES"
+awk '
+match($0, /COBALT_SYSCALL\([^,]*, [^,]*/)  {
+	str=substr($0, RSTART + 15, RLENGTH - 15)
+	match(str, /[^,]*/)
+	print "__COBALT_CALL_ENTRY(" substr(str, RSTART, RLENGTH) ")"
+}
+' $*
+echo "#endif"
+
+echo "#ifdef COBALT_LIST_MODES"
+awk '
+match($0, /COBALT_SYSCALL\([^,]*, [^,]*/)  {
+	str=substr($0, RSTART + 15, RLENGTH - 15)
+	print "__COBALT_MODE(" str ")"
+}
+' $*
+echo "#endif"
diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
index 36cfc3b..abe9fea 100644
--- a/kernel/cobalt/posix/syscall.c
+++ b/kernel/cobalt/posix/syscall.c
@@ -548,222 +548,40 @@ static int cobalt_ni(void)
 #define __COBALT_NI	__syshand__(ni)
 
 #define __COBALT_CALL_NI				\
-	[0 ... __NR_COBALT_SYSCALLS-1] = __COBALT_NI	\
+	[0 ... __NR_COBALT_SYSCALLS-1] = __COBALT_NI,	\
 	__COBALT_CALL32_INITHAND(__COBALT_NI)
 
 #define __COBALT_CALL_NFLAGS				\
-	[0 ... __NR_COBALT_SYSCALLS-1] = 0		\
+	[0 ... __NR_COBALT_SYSCALLS-1] = 0,		\
 	__COBALT_CALL32_INITMODE(0)
 
 #define __COBALT_CALL_ENTRY(__name)				\
-	[sc_cobalt_ ## __name] = __syshand__(__name)		\
+	[sc_cobalt_ ## __name] = __syshand__(__name),		\
 	__COBALT_CALL32_ENTRY(__name, __syshand__(__name))
 
 #define __COBALT_MODE(__name, __mode)	\
-	[sc_cobalt_ ## __name] = __xn_exec_##__mode
+	[sc_cobalt_ ## __name] = __xn_exec_##__mode,
 
 #ifdef CONFIG_XENO_ARCH_SYS3264
 #include "syscall32.h"
 #endif
 
 static const cobalt_syshand cobalt_syscalls[] = {
-	__COBALT_CALL_NI,
-	__COBALT_CALL_ENTRY(thread_create),
-	__COBALT_CALL_ENTRY(thread_getpid),
-	__COBALT_CALL_ENTRY(thread_setschedparam_ex),
-	__COBALT_CALL_ENTRY(thread_getschedparam_ex),
-	__COBALT_CALL_ENTRY(sched_weightprio),
-	__COBALT_CALL_ENTRY(sched_yield),
-	__COBALT_CALL_ENTRY(thread_setmode),
-	__COBALT_CALL_ENTRY(thread_setname),
-	__COBALT_CALL_ENTRY(thread_kill),
-	__COBALT_CALL_ENTRY(thread_getstat),
-	__COBALT_CALL_ENTRY(thread_join),
-	__COBALT_CALL_ENTRY(sem_init),
-	__COBALT_CALL_ENTRY(sem_destroy),
-	__COBALT_CALL_ENTRY(sem_post),
-	__COBALT_CALL_ENTRY(sem_wait),
-	__COBALT_CALL_ENTRY(sem_timedwait),
-	__COBALT_CALL_ENTRY(sem_trywait),
-	__COBALT_CALL_ENTRY(sem_getvalue),
-	__COBALT_CALL_ENTRY(sem_open),
-	__COBALT_CALL_ENTRY(sem_close),
-	__COBALT_CALL_ENTRY(sem_unlink),
-	__COBALT_CALL_ENTRY(sem_broadcast_np),
-	__COBALT_CALL_ENTRY(sem_inquire),
-	__COBALT_CALL_ENTRY(clock_getres),
-	__COBALT_CALL_ENTRY(clock_gettime),
-	__COBALT_CALL_ENTRY(clock_settime),
-	__COBALT_CALL_ENTRY(clock_nanosleep),
-	__COBALT_CALL_ENTRY(mutex_init),
-	__COBALT_CALL_ENTRY(mutex_check_init),
-	__COBALT_CALL_ENTRY(mutex_destroy),
-	__COBALT_CALL_ENTRY(mutex_lock),
-	__COBALT_CALL_ENTRY(mutex_timedlock),
-	__COBALT_CALL_ENTRY(mutex_trylock),
-	__COBALT_CALL_ENTRY(mutex_unlock),
-	__COBALT_CALL_ENTRY(cond_init),
-	__COBALT_CALL_ENTRY(cond_destroy),
-	__COBALT_CALL_ENTRY(cond_wait_prologue),
-	__COBALT_CALL_ENTRY(cond_wait_epilogue),
-	__COBALT_CALL_ENTRY(mq_open),
-	__COBALT_CALL_ENTRY(mq_close),
-	__COBALT_CALL_ENTRY(mq_unlink),
-	__COBALT_CALL_ENTRY(mq_getattr),
-	__COBALT_CALL_ENTRY(mq_timedsend),
-	__COBALT_CALL_ENTRY(mq_timedreceive),
-	__COBALT_CALL_ENTRY(mq_notify),
-	__COBALT_CALL_ENTRY(sigwait),
-	__COBALT_CALL_ENTRY(sigwaitinfo),
-	__COBALT_CALL_ENTRY(sigtimedwait),
-	__COBALT_CALL_ENTRY(sigpending),
-	__COBALT_CALL_ENTRY(kill),
-	__COBALT_CALL_ENTRY(sigqueue),
-	__COBALT_CALL_ENTRY(timer_create),
-	__COBALT_CALL_ENTRY(timer_delete),
-	__COBALT_CALL_ENTRY(timer_settime),
-	__COBALT_CALL_ENTRY(timer_gettime),
-	__COBALT_CALL_ENTRY(timer_getoverrun),
-	__COBALT_CALL_ENTRY(timerfd_create),
-	__COBALT_CALL_ENTRY(timerfd_gettime),
-	__COBALT_CALL_ENTRY(timerfd_settime),
-	__COBALT_CALL_ENTRY(select),
-	__COBALT_CALL_ENTRY(sched_minprio),
-	__COBALT_CALL_ENTRY(sched_maxprio),
-	__COBALT_CALL_ENTRY(monitor_init),
-	__COBALT_CALL_ENTRY(monitor_destroy),
-	__COBALT_CALL_ENTRY(monitor_enter),
-	__COBALT_CALL_ENTRY(monitor_wait),
-	__COBALT_CALL_ENTRY(monitor_sync),
-	__COBALT_CALL_ENTRY(monitor_exit),
-	__COBALT_CALL_ENTRY(event_init),
-	__COBALT_CALL_ENTRY(event_destroy),
-	__COBALT_CALL_ENTRY(event_wait),
-	__COBALT_CALL_ENTRY(event_sync),
-	__COBALT_CALL_ENTRY(event_inquire),
-	__COBALT_CALL_ENTRY(sched_setconfig_np),
-	__COBALT_CALL_ENTRY(sched_getconfig_np),
-	__COBALT_CALL_ENTRY(open),
-	__COBALT_CALL_ENTRY(socket),
-	__COBALT_CALL_ENTRY(close),
-	__COBALT_CALL_ENTRY(mmap),
-	__COBALT_CALL_ENTRY(ioctl),
-	__COBALT_CALL_ENTRY(read),
-	__COBALT_CALL_ENTRY(write),
-	__COBALT_CALL_ENTRY(recvmsg),
-	__COBALT_CALL_ENTRY(sendmsg),
-	__COBALT_CALL_ENTRY(migrate),
-	__COBALT_CALL_ENTRY(archcall),
-	__COBALT_CALL_ENTRY(bind),
-	__COBALT_CALL_ENTRY(extend),
-	__COBALT_CALL_ENTRY(trace),
-	__COBALT_CALL_ENTRY(get_current),
-	__COBALT_CALL_ENTRY(backtrace),
-	__COBALT_CALL_ENTRY(serialdbg),
-	__COBALT_CALL_ENTRY(corectl),
-	__COBALT_CALL_ENTRY(fcntl)
-	/* NO COMMA AT END */
+	__COBALT_CALL_NI
+#define COBALT_LIST_CALL_ENTRIES 1
+#include "syscall_entries.h"
+#undef COBALT_LIST_CALL_ENTRIES
+
 #ifdef CONFIG_XENO_ARCH_SYS3264
 #include <asm/xenomai/syscall32-table.h>
 #endif
 };
 
 static const int cobalt_sysmodes[] = {
-	__COBALT_CALL_NFLAGS,
-	__COBALT_MODE(thread_create, init),
-	__COBALT_MODE(thread_getpid, current),
-	__COBALT_MODE(thread_setschedparam_ex, conforming),
-	__COBALT_MODE(thread_getschedparam_ex, current),
-	__COBALT_MODE(sched_weightprio, current),
-	__COBALT_MODE(sched_yield, primary),
-	__COBALT_MODE(thread_setmode, primary),
-	__COBALT_MODE(thread_setname, current),
-	__COBALT_MODE(thread_kill, conforming),
-	__COBALT_MODE(thread_getstat, current),
-	__COBALT_MODE(thread_join, primary),
-	__COBALT_MODE(sem_init, current),
-	__COBALT_MODE(sem_destroy, current),
-	__COBALT_MODE(sem_post, current),
-	__COBALT_MODE(sem_wait, primary),
-	__COBALT_MODE(sem_timedwait, primary),
-	__COBALT_MODE(sem_trywait, primary),
-	__COBALT_MODE(sem_getvalue, current),
-	__COBALT_MODE(sem_open, lostage),
-	__COBALT_MODE(sem_close, lostage),
-	__COBALT_MODE(sem_unlink, lostage),
-	__COBALT_MODE(sem_broadcast_np, current),
-	__COBALT_MODE(sem_inquire, current),
-	__COBALT_MODE(clock_getres, current),
-	__COBALT_MODE(clock_gettime, current),
-	__COBALT_MODE(clock_settime, current),
-	__COBALT_MODE(clock_nanosleep, nonrestartable),
-	__COBALT_MODE(mutex_init, current),
-	__COBALT_MODE(mutex_check_init, current),
-	__COBALT_MODE(mutex_destroy, current),
-	__COBALT_MODE(mutex_lock, primary),
-	__COBALT_MODE(mutex_timedlock, primary),
-	__COBALT_MODE(mutex_trylock, primary),
-	__COBALT_MODE(mutex_unlock, nonrestartable),
-	__COBALT_MODE(cond_init, current),
-	__COBALT_MODE(cond_destroy, current),
-	__COBALT_MODE(cond_wait_prologue, nonrestartable),
-	__COBALT_MODE(cond_wait_epilogue, primary),
-	__COBALT_MODE(mq_open, lostage),
-	__COBALT_MODE(mq_close, lostage),
-	__COBALT_MODE(mq_unlink, lostage),
-	__COBALT_MODE(mq_getattr, current),
-	__COBALT_MODE(mq_timedsend, primary),
-	__COBALT_MODE(mq_timedreceive, primary),
-	__COBALT_MODE(mq_notify, primary),
-	__COBALT_MODE(sigwait, primary),
-	__COBALT_MODE(sigwaitinfo, nonrestartable),
-	__COBALT_MODE(sigtimedwait, nonrestartable),
-	__COBALT_MODE(sigpending, primary),
-	__COBALT_MODE(kill, conforming),
-	__COBALT_MODE(sigqueue, conforming),
-	__COBALT_MODE(timer_create, current),
-	__COBALT_MODE(timer_delete, current),
-	__COBALT_MODE(timer_settime, primary),
-	__COBALT_MODE(timer_gettime, current),
-	__COBALT_MODE(timer_getoverrun, current),
-	__COBALT_MODE(timerfd_create, lostage),
-	__COBALT_MODE(timerfd_gettime, current),
-	__COBALT_MODE(timerfd_settime, primary),
-	__COBALT_MODE(select, nonrestartable),
-	__COBALT_MODE(sched_minprio, current),
-	__COBALT_MODE(sched_maxprio, current),
-	__COBALT_MODE(monitor_init, current),
-	__COBALT_MODE(monitor_destroy, primary),
-	__COBALT_MODE(monitor_enter, primary),
-	__COBALT_MODE(monitor_wait, nonrestartable),
-	__COBALT_MODE(monitor_sync, nonrestartable),
-	__COBALT_MODE(monitor_exit, primary),
-	__COBALT_MODE(event_init, current),
-	__COBALT_MODE(event_destroy, current),
-	__COBALT_MODE(event_wait, primary),
-	__COBALT_MODE(event_sync, current),
-	__COBALT_MODE(event_inquire, current),
-	__COBALT_MODE(sched_setconfig_np, conforming),
-	__COBALT_MODE(sched_getconfig_np, conforming),
-	__COBALT_MODE(open, lostage),
-	__COBALT_MODE(socket, lostage),
-	__COBALT_MODE(close, lostage),
-	__COBALT_MODE(mmap, lostage),
-	__COBALT_MODE(ioctl, probing),
-	__COBALT_MODE(read, probing),
-	__COBALT_MODE(write, probing),
-	__COBALT_MODE(recvmsg, probing),
-	__COBALT_MODE(sendmsg, probing),
-	__COBALT_MODE(migrate, current),
-	__COBALT_MODE(archcall, current),
-	__COBALT_MODE(bind, lostage),
-	__COBALT_MODE(extend, lostage),
-	__COBALT_MODE(trace, current),
-	__COBALT_MODE(get_current, current),
-	__COBALT_MODE(backtrace, lostage),
-	__COBALT_MODE(serialdbg, current),
-	__COBALT_MODE(corectl, probing),
-	__COBALT_MODE(fcntl, current),
+	__COBALT_CALL_NFLAGS
+#define COBALT_LIST_MODES 1
+#include "syscall_entries.h"
+#undef COBALT_LIST_MODES
 };
 
 static inline int allowed_syscall(struct cobalt_process *process,
diff --git a/scripts/prepare-kernel.sh b/scripts/prepare-kernel.sh
index dbc5d24..8e960e8 100755
--- a/scripts/prepare-kernel.sh
+++ b/scripts/prepare-kernel.sh
@@ -100,8 +100,8 @@ patch_link() {
 	       recursive_opt="-maxdepth 1"
 	       dir_opt=""
            fi
-	   find_clean_opt="$recursive_opt \( $dir_opt $link_makefiles_opt -name Kconfig -o -name '*.[chS]' \)"
-	   find_link_opt="$recursive_opt \( $link_makefiles_opt -name Kconfig -o -name '*.[chS]' \)"
+	   find_clean_opt="$recursive_opt \( $dir_opt $link_makefiles_opt -name Kconfig -o -name '*.[chS]' -o -name '*.sh' \)"
+	   find_link_opt="$recursive_opt \( $link_makefiles_opt -name Kconfig -o -name '*.[chS]' -o -name '*.sh' \)"
 	fi
 
         if test "x$output_patch" = "x" -a -e $linux_tree/$link_dir; then
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* Re: [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
  2015-07-02 20:26                             ` Jan Kiszka
@ 2015-07-03 10:51                               ` Gilles Chanteperdrix
  2015-07-03 12:31                                 ` Gilles Chanteperdrix
  2015-07-16 12:34                                 ` Jan Kiszka
  0 siblings, 2 replies; 28+ messages in thread
From: Gilles Chanteperdrix @ 2015-07-03 10:51 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai

On Thu, Jul 02, 2015 at 10:26:24PM +0200, Jan Kiszka wrote:
> Just FYI - still requires testing and more review - find a first
> generator version below.
> 
> Jan
> 
> 
> cobalt/posix/syscall: Generate cobalt_syscalls and cobalt_sysmodes
> 
> ---
>  .../arch/x86/include/asm/xenomai/syscall32.h       |  12 +-
>  kernel/cobalt/posix/Makefile                       |  12 ++
>  kernel/cobalt/posix/gen-syscall-entries.sh         |  24 +++
>  kernel/cobalt/posix/syscall.c                      | 208 ++-------------------
>  scripts/prepare-kernel.sh                          |   4 +-
>  5 files changed, 57 insertions(+), 203 deletions(-)
>  create mode 100755 kernel/cobalt/posix/gen-syscall-entries.sh
> 
> diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h
> index 8bd40d4..58b7336 100644
> --- a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h
> +++ b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h
> @@ -45,14 +45,14 @@
>  #define __syshand32x__(__name)	((cobalt_syshand)(cobalt32x_ ## __name))
>  
>  #define __COBALT_CALL32x_INITHAND(__handler)	\
> -  , [__COBALT_X32_BASE ... __COBALT_X32_BASE + __NR_COBALT_SYSCALLS-1] = __handler
> +	[__COBALT_X32_BASE ... __COBALT_X32_BASE + __NR_COBALT_SYSCALLS-1] = __handler,
>  
>  #define __COBALT_CALL32x_INITMODE(__mode)	\
> -  , [__COBALT_X32_BASE ... __COBALT_X32_BASE + __NR_COBALT_SYSCALLS-1] = __mode
> +	[__COBALT_X32_BASE ... __COBALT_X32_BASE + __NR_COBALT_SYSCALLS-1] = __mode,
>  
>  /* x32 default entry (no thunk) */
>  #define __COBALT_CALL32x_ENTRY(__name, __handler)		\
> -	, [sc_cobalt_ ## __name + __COBALT_X32_BASE] = __handler
> +	[sc_cobalt_ ## __name + __COBALT_X32_BASE] = __handler,
>  
>  /* x32 thunk installation */
>  #define __COBALT_CALL32x_pure_THUNK(__name)	\
> @@ -113,14 +113,14 @@
>  #define __syshand32emu__(__name)	((cobalt_syshand)(cobalt32emu_ ## __name))
>  
>  #define __COBALT_CALL32emu_INITHAND(__handler)	\
> -  , [__COBALT_IA32_BASE ... __COBALT_IA32_BASE + __NR_COBALT_SYSCALLS-1] = __handler
> +	[__COBALT_IA32_BASE ... __COBALT_IA32_BASE + __NR_COBALT_SYSCALLS-1] = __handler,
>  
>  #define __COBALT_CALL32emu_INITMODE(__mode)	\
> -  , [__COBALT_IA32_BASE ... __COBALT_IA32_BASE + __NR_COBALT_SYSCALLS-1] = __mode
> +	[__COBALT_IA32_BASE ... __COBALT_IA32_BASE + __NR_COBALT_SYSCALLS-1] = __mode,
>  
>  /* ia32 default entry (no thunk) */
>  #define __COBALT_CALL32emu_ENTRY(__name, __handler)		\
> -	, [sc_cobalt_ ## __name + __COBALT_IA32_BASE] = __handler
> +	[sc_cobalt_ ## __name + __COBALT_IA32_BASE] = __handler,
>  
>  /* ia32 thunk installation */
>  #define __COBALT_CALL32emu_THUNK(__name)	\

Whether this is needed is debatable. From my point of view, it is
not needed. But in any case, this has nothing to do with what this
patch does.


> diff --git a/kernel/cobalt/posix/Makefile b/kernel/cobalt/posix/Makefile
> index 3049be4..2da764a 100644
> --- a/kernel/cobalt/posix/Makefile
> +++ b/kernel/cobalt/posix/Makefile
> @@ -22,4 +22,16 @@ xenomai-y :=		\
>  	timer.o		\
>  	timerfd.o
>  
> +syscall_entries := $(srctree)/$(src)/gen-syscall-entries.sh
> +
> +quiet_cmd_syscall_entries = GEN     $@
> +      cmd_syscall_entries = $(CONFIG_SHELL) '$(syscall_entries)' $^ > $@
> +
> +$(obj)/syscall_entries.h: $(syscall_entries) $(wildcard $(srctree)/$(src)/*.c)
> +	$(call if_changed,syscall_entries)
> +
> +target += syscall_entries.h
> +
> +$(obj)/syscall.o: $(obj)/syscall_entries.h
> +
>  xenomai-$(CONFIG_XENO_ARCH_SYS3264) += compat.o syscall32.o
> diff --git a/kernel/cobalt/posix/gen-syscall-entries.sh b/kernel/cobalt/posix/gen-syscall-entries.sh
> new file mode 100755
> index 0000000..36b1e69
> --- /dev/null
> +++ b/kernel/cobalt/posix/gen-syscall-entries.sh
> @@ -0,0 +1,24 @@
> +#! /bin/sh
> +
> +set -e
> +
> +shift
> +
> +echo "#ifdef COBALT_LIST_CALL_ENTRIES"
> +awk '
> +match($0, /COBALT_SYSCALL\([^,]*, [^,]*/)  {
> +	str=substr($0, RSTART + 15, RLENGTH - 15)
> +	match(str, /[^,]*/)
> +	print "__COBALT_CALL_ENTRY(" substr(str, RSTART, RLENGTH) ")"
> +}
> +' $*
> +echo "#endif"
> +
> +echo "#ifdef COBALT_LIST_MODES"
> +awk '
> +match($0, /COBALT_SYSCALL\([^,]*, [^,]*/)  {
> +	str=substr($0, RSTART + 15, RLENGTH - 15)
> +	print "__COBALT_MODE(" str ")"
> +}
> +' $*
> +echo "#endif"

This is particularly inelegant:
- you do not need awk to do that, sed is sufficient
- with using awk, you can generate the two files in one pass, and
remove the #ifdefs trick;
- I think the awk script should at least generate an error in case
of parser error

I will submit an awk script which does that.


> diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
> index 36cfc3b..abe9fea 100644
> --- a/kernel/cobalt/posix/syscall.c
> +++ b/kernel/cobalt/posix/syscall.c
> @@ -548,222 +548,40 @@ static int cobalt_ni(void)
>  #define __COBALT_NI	__syshand__(ni)
>  
>  #define __COBALT_CALL_NI				\
> -	[0 ... __NR_COBALT_SYSCALLS-1] = __COBALT_NI	\
> +	[0 ... __NR_COBALT_SYSCALLS-1] = __COBALT_NI,	\
>  	__COBALT_CALL32_INITHAND(__COBALT_NI)
>  
>  #define __COBALT_CALL_NFLAGS				\
> -	[0 ... __NR_COBALT_SYSCALLS-1] = 0		\
> +	[0 ... __NR_COBALT_SYSCALLS-1] = 0,		\
>  	__COBALT_CALL32_INITMODE(0)
>  
>  #define __COBALT_CALL_ENTRY(__name)				\
> -	[sc_cobalt_ ## __name] = __syshand__(__name)		\
> +	[sc_cobalt_ ## __name] = __syshand__(__name),		\
>  	__COBALT_CALL32_ENTRY(__name, __syshand__(__name))
>  
>  #define __COBALT_MODE(__name, __mode)	\
> -	[sc_cobalt_ ## __name] = __xn_exec_##__mode
> +	[sc_cobalt_ ## __name] = __xn_exec_##__mode,

Again, unrelated changes.

-- 
					    Gilles.
https://click-hack.org


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
  2015-07-03 10:51                               ` Gilles Chanteperdrix
@ 2015-07-03 12:31                                 ` Gilles Chanteperdrix
  2015-07-03 12:38                                   ` Gilles Chanteperdrix
  2015-07-16 12:34                                 ` Jan Kiszka
  1 sibling, 1 reply; 28+ messages in thread
From: Gilles Chanteperdrix @ 2015-07-03 12:31 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai

On Fri, Jul 03, 2015 at 12:51:49PM +0200, Gilles Chanteperdrix wrote:
> > index 0000000..36b1e69
> > --- /dev/null
> > +++ b/kernel/cobalt/posix/gen-syscall-entries.sh
> > @@ -0,0 +1,24 @@
> > +#! /bin/sh
> > +
> > +set -e
> > +
> > +shift
> > +
> > +echo "#ifdef COBALT_LIST_CALL_ENTRIES"
> > +awk '
> > +match($0, /COBALT_SYSCALL\([^,]*, [^,]*/)  {
> > +	str=substr($0, RSTART + 15, RLENGTH - 15)
> > +	match(str, /[^,]*/)
> > +	print "__COBALT_CALL_ENTRY(" substr(str, RSTART, RLENGTH) ")"
> > +}
> > +' $*
> > +echo "#endif"
> > +
> > +echo "#ifdef COBALT_LIST_MODES"
> > +awk '
> > +match($0, /COBALT_SYSCALL\([^,]*, [^,]*/)  {
> > +	str=substr($0, RSTART + 15, RLENGTH - 15)
> > +	print "__COBALT_MODE(" str ")"
> > +}
> > +' $*
> > +echo "#endif"
> 
> This is particularly inelegant:
> - you do not need awk to do that, sed is sufficient
> - with using awk, you can generate the two files in one pass, and
> remove the #ifdefs trick;
> - I think the awk script should at least generate an error in case
> of parser error
> 
> I will submit an awk script which does that.

Ok, another awk script which does that:

BEGIN {
	system("rm -f syscalls_modes.h syscalls_entries.h")
}

match($0, /COBALT_SYSCALL\([^,]*,[ \t]*[^,]*/)  {
	str=substr($0, RSTART + 15, RLENGTH - 15)
	match(str, /[^, \t]*/)
	syscall=substr(str, RSTART, RLENGTH)

	if (syscall == "") {
		print "Failed to find syscall name in line " $0
		exit 1
	}

	print "__COBALT_MODE(" str ")," >> "syscalls_modes.h"
	print "__COBALT_CALL_ENTRY(" syscall ")," >> "syscalls_entries.h"
	next
}

/COBALT_SYSCALL\(/  {
	print "Failed to parse line " $0
	exit 1
}

It supposes it is running from the output directory, but we can pass
the output directory as a parameter if you prefer.

-- 
					    Gilles.
https://click-hack.org


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
  2015-07-03 12:31                                 ` Gilles Chanteperdrix
@ 2015-07-03 12:38                                   ` Gilles Chanteperdrix
  2015-07-16 12:35                                     ` Jan Kiszka
  0 siblings, 1 reply; 28+ messages in thread
From: Gilles Chanteperdrix @ 2015-07-03 12:38 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai

On Fri, Jul 03, 2015 at 02:31:25PM +0200, Gilles Chanteperdrix wrote:
> On Fri, Jul 03, 2015 at 12:51:49PM +0200, Gilles Chanteperdrix wrote:
> > > index 0000000..36b1e69
> > > --- /dev/null
> > > +++ b/kernel/cobalt/posix/gen-syscall-entries.sh
> > > @@ -0,0 +1,24 @@
> > > +#! /bin/sh
> > > +
> > > +set -e
> > > +
> > > +shift
> > > +
> > > +echo "#ifdef COBALT_LIST_CALL_ENTRIES"
> > > +awk '
> > > +match($0, /COBALT_SYSCALL\([^,]*, [^,]*/)  {
> > > +	str=substr($0, RSTART + 15, RLENGTH - 15)
> > > +	match(str, /[^,]*/)
> > > +	print "__COBALT_CALL_ENTRY(" substr(str, RSTART, RLENGTH) ")"
> > > +}
> > > +' $*
> > > +echo "#endif"
> > > +
> > > +echo "#ifdef COBALT_LIST_MODES"
> > > +awk '
> > > +match($0, /COBALT_SYSCALL\([^,]*, [^,]*/)  {
> > > +	str=substr($0, RSTART + 15, RLENGTH - 15)
> > > +	print "__COBALT_MODE(" str ")"
> > > +}
> > > +' $*
> > > +echo "#endif"
> > 
> > This is particularly inelegant:
> > - you do not need awk to do that, sed is sufficient
> > - with using awk, you can generate the two files in one pass, and
> > remove the #ifdefs trick;
> > - I think the awk script should at least generate an error in case
> > of parser error
> > 
> > I will submit an awk script which does that.
> 
> Ok, another awk script which does that:
> 
> BEGIN {
> 	system("rm -f syscalls_modes.h syscalls_entries.h")
> }
> 
> match($0, /COBALT_SYSCALL\([^,]*,[ \t]*[^,]*/)  {
> 	str=substr($0, RSTART + 15, RLENGTH - 15)
> 	match(str, /[^, \t]*/)
> 	syscall=substr(str, RSTART, RLENGTH)
> 
> 	if (syscall == "") {
> 		print "Failed to find syscall name in line " $0
> 		exit 1
> 	}
> 
> 	print "__COBALT_MODE(" str ")," >> "syscalls_modes.h"
> 	print "__COBALT_CALL_ENTRY(" syscall ")," >> "syscalls_entries.h"
> 	next
> }
> 
> /COBALT_SYSCALL\(/  {
> 	print "Failed to parse line " $0
> 	exit 1
> }
> 
> It supposes it is running from the output directory, but we can pass
> the output directory as a parameter if you prefer.

Note that the simplistic approach taken precludes the use of
conditional compilation with syscall definitions.

-- 
					    Gilles.
https://click-hack.org


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
  2015-07-03 10:51                               ` Gilles Chanteperdrix
  2015-07-03 12:31                                 ` Gilles Chanteperdrix
@ 2015-07-16 12:34                                 ` Jan Kiszka
  1 sibling, 0 replies; 28+ messages in thread
From: Jan Kiszka @ 2015-07-16 12:34 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai

On 2015-07-03 12:51, Gilles Chanteperdrix wrote:
> On Thu, Jul 02, 2015 at 10:26:24PM +0200, Jan Kiszka wrote:
>> Just FYI - still requires testing and more review - find a first
>> generator version below.
>>
>> Jan
>>
>>
>> cobalt/posix/syscall: Generate cobalt_syscalls and cobalt_sysmodes
>>
>> ---
>>  .../arch/x86/include/asm/xenomai/syscall32.h       |  12 +-
>>  kernel/cobalt/posix/Makefile                       |  12 ++
>>  kernel/cobalt/posix/gen-syscall-entries.sh         |  24 +++
>>  kernel/cobalt/posix/syscall.c                      | 208 ++-------------------
>>  scripts/prepare-kernel.sh                          |   4 +-
>>  5 files changed, 57 insertions(+), 203 deletions(-)
>>  create mode 100755 kernel/cobalt/posix/gen-syscall-entries.sh
>>
>> diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h
>> index 8bd40d4..58b7336 100644
>> --- a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h
>> +++ b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h
>> @@ -45,14 +45,14 @@
>>  #define __syshand32x__(__name)	((cobalt_syshand)(cobalt32x_ ## __name))
>>  
>>  #define __COBALT_CALL32x_INITHAND(__handler)	\
>> -  , [__COBALT_X32_BASE ... __COBALT_X32_BASE + __NR_COBALT_SYSCALLS-1] = __handler
>> +	[__COBALT_X32_BASE ... __COBALT_X32_BASE + __NR_COBALT_SYSCALLS-1] = __handler,
>>  
>>  #define __COBALT_CALL32x_INITMODE(__mode)	\
>> -  , [__COBALT_X32_BASE ... __COBALT_X32_BASE + __NR_COBALT_SYSCALLS-1] = __mode
>> +	[__COBALT_X32_BASE ... __COBALT_X32_BASE + __NR_COBALT_SYSCALLS-1] = __mode,
>>  
>>  /* x32 default entry (no thunk) */
>>  #define __COBALT_CALL32x_ENTRY(__name, __handler)		\
>> -	, [sc_cobalt_ ## __name + __COBALT_X32_BASE] = __handler
>> +	[sc_cobalt_ ## __name + __COBALT_X32_BASE] = __handler,
>>  
>>  /* x32 thunk installation */
>>  #define __COBALT_CALL32x_pure_THUNK(__name)	\
>> @@ -113,14 +113,14 @@
>>  #define __syshand32emu__(__name)	((cobalt_syshand)(cobalt32emu_ ## __name))
>>  
>>  #define __COBALT_CALL32emu_INITHAND(__handler)	\
>> -  , [__COBALT_IA32_BASE ... __COBALT_IA32_BASE + __NR_COBALT_SYSCALLS-1] = __handler
>> +	[__COBALT_IA32_BASE ... __COBALT_IA32_BASE + __NR_COBALT_SYSCALLS-1] = __handler,
>>  
>>  #define __COBALT_CALL32emu_INITMODE(__mode)	\
>> -  , [__COBALT_IA32_BASE ... __COBALT_IA32_BASE + __NR_COBALT_SYSCALLS-1] = __mode
>> +	[__COBALT_IA32_BASE ... __COBALT_IA32_BASE + __NR_COBALT_SYSCALLS-1] = __mode,
>>  
>>  /* ia32 default entry (no thunk) */
>>  #define __COBALT_CALL32emu_ENTRY(__name, __handler)		\
>> -	, [sc_cobalt_ ## __name + __COBALT_IA32_BASE] = __handler
>> +	[sc_cobalt_ ## __name + __COBALT_IA32_BASE] = __handler,
>>  
>>  /* ia32 thunk installation */
>>  #define __COBALT_CALL32emu_THUNK(__name)	\
> 
> Whether this is needed is debatable. From my point of view, it is
> not needed. But in any case, this has nothing to do with what this
> patch does.

It's a precondition for generating a regular list of table entries. But
I'll split this up into a separate patch.

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
  2015-07-03 12:38                                   ` Gilles Chanteperdrix
@ 2015-07-16 12:35                                     ` Jan Kiszka
  2015-07-16 18:42                                       ` Jan Kiszka
  0 siblings, 1 reply; 28+ messages in thread
From: Jan Kiszka @ 2015-07-16 12:35 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai

On 2015-07-03 14:38, Gilles Chanteperdrix wrote:
> On Fri, Jul 03, 2015 at 02:31:25PM +0200, Gilles Chanteperdrix wrote:
>> On Fri, Jul 03, 2015 at 12:51:49PM +0200, Gilles Chanteperdrix wrote:
>>>> index 0000000..36b1e69
>>>> --- /dev/null
>>>> +++ b/kernel/cobalt/posix/gen-syscall-entries.sh
>>>> @@ -0,0 +1,24 @@
>>>> +#! /bin/sh
>>>> +
>>>> +set -e
>>>> +
>>>> +shift
>>>> +
>>>> +echo "#ifdef COBALT_LIST_CALL_ENTRIES"
>>>> +awk '
>>>> +match($0, /COBALT_SYSCALL\([^,]*, [^,]*/)  {
>>>> +	str=substr($0, RSTART + 15, RLENGTH - 15)
>>>> +	match(str, /[^,]*/)
>>>> +	print "__COBALT_CALL_ENTRY(" substr(str, RSTART, RLENGTH) ")"
>>>> +}
>>>> +' $*
>>>> +echo "#endif"
>>>> +
>>>> +echo "#ifdef COBALT_LIST_MODES"
>>>> +awk '
>>>> +match($0, /COBALT_SYSCALL\([^,]*, [^,]*/)  {
>>>> +	str=substr($0, RSTART + 15, RLENGTH - 15)
>>>> +	print "__COBALT_MODE(" str ")"
>>>> +}
>>>> +' $*
>>>> +echo "#endif"
>>>
>>> This is particularly inelegant:
>>> - you do not need awk to do that, sed is sufficient
>>> - with using awk, you can generate the two files in one pass, and
>>> remove the #ifdefs trick;
>>> - I think the awk script should at least generate an error in case
>>> of parser error
>>>
>>> I will submit an awk script which does that.
>>
>> Ok, another awk script which does that:
>>
>> BEGIN {
>> 	system("rm -f syscalls_modes.h syscalls_entries.h")
>> }
>>
>> match($0, /COBALT_SYSCALL\([^,]*,[ \t]*[^,]*/)  {
>> 	str=substr($0, RSTART + 15, RLENGTH - 15)
>> 	match(str, /[^, \t]*/)
>> 	syscall=substr(str, RSTART, RLENGTH)
>>
>> 	if (syscall == "") {
>> 		print "Failed to find syscall name in line " $0
>> 		exit 1
>> 	}
>>
>> 	print "__COBALT_MODE(" str ")," >> "syscalls_modes.h"
>> 	print "__COBALT_CALL_ENTRY(" syscall ")," >> "syscalls_entries.h"
>> 	next
>> }
>>
>> /COBALT_SYSCALL\(/  {
>> 	print "Failed to parse line " $0
>> 	exit 1
>> }
>>
>> It supposes it is running from the output directory, but we can pass
>> the output directory as a parameter if you prefer.
> 
> Note that the simplistic approach taken precludes the use of
> conditional compilation with syscall definitions.

I'll parametrize and integrate this, thanks.

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
  2015-07-16 12:35                                     ` Jan Kiszka
@ 2015-07-16 18:42                                       ` Jan Kiszka
  2015-07-16 22:34                                         ` Gilles Chanteperdrix
  0 siblings, 1 reply; 28+ messages in thread
From: Jan Kiszka @ 2015-07-16 18:42 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai

On 2015-07-16 14:35, Jan Kiszka wrote:
> On 2015-07-03 14:38, Gilles Chanteperdrix wrote:
>> On Fri, Jul 03, 2015 at 02:31:25PM +0200, Gilles Chanteperdrix wrote:
>>> On Fri, Jul 03, 2015 at 12:51:49PM +0200, Gilles Chanteperdrix wrote:
>>>>> index 0000000..36b1e69
>>>>> --- /dev/null
>>>>> +++ b/kernel/cobalt/posix/gen-syscall-entries.sh
>>>>> @@ -0,0 +1,24 @@
>>>>> +#! /bin/sh
>>>>> +
>>>>> +set -e
>>>>> +
>>>>> +shift
>>>>> +
>>>>> +echo "#ifdef COBALT_LIST_CALL_ENTRIES"
>>>>> +awk '
>>>>> +match($0, /COBALT_SYSCALL\([^,]*, [^,]*/)  {
>>>>> +	str=substr($0, RSTART + 15, RLENGTH - 15)
>>>>> +	match(str, /[^,]*/)
>>>>> +	print "__COBALT_CALL_ENTRY(" substr(str, RSTART, RLENGTH) ")"
>>>>> +}
>>>>> +' $*
>>>>> +echo "#endif"
>>>>> +
>>>>> +echo "#ifdef COBALT_LIST_MODES"
>>>>> +awk '
>>>>> +match($0, /COBALT_SYSCALL\([^,]*, [^,]*/)  {
>>>>> +	str=substr($0, RSTART + 15, RLENGTH - 15)
>>>>> +	print "__COBALT_MODE(" str ")"
>>>>> +}
>>>>> +' $*
>>>>> +echo "#endif"
>>>>
>>>> This is particularly inelegant:
>>>> - you do not need awk to do that, sed is sufficient
>>>> - with using awk, you can generate the two files in one pass, and
>>>> remove the #ifdefs trick;
>>>> - I think the awk script should at least generate an error in case
>>>> of parser error
>>>>
>>>> I will submit an awk script which does that.
>>>
>>> Ok, another awk script which does that:
>>>
>>> BEGIN {
>>> 	system("rm -f syscalls_modes.h syscalls_entries.h")
>>> }
>>>
>>> match($0, /COBALT_SYSCALL\([^,]*,[ \t]*[^,]*/)  {
>>> 	str=substr($0, RSTART + 15, RLENGTH - 15)
>>> 	match(str, /[^, \t]*/)
>>> 	syscall=substr(str, RSTART, RLENGTH)
>>>
>>> 	if (syscall == "") {
>>> 		print "Failed to find syscall name in line " $0
>>> 		exit 1
>>> 	}
>>>
>>> 	print "__COBALT_MODE(" str ")," >> "syscalls_modes.h"
>>> 	print "__COBALT_CALL_ENTRY(" syscall ")," >> "syscalls_entries.h"
>>> 	next
>>> }
>>>
>>> /COBALT_SYSCALL\(/  {
>>> 	print "Failed to parse line " $0
>>> 	exit 1
>>> }
>>>
>>> It supposes it is running from the output directory, but we can pass
>>> the output directory as a parameter if you prefer.
>>
>> Note that the simplistic approach taken precludes the use of
>> conditional compilation with syscall definitions.
> 
> I'll parametrize and integrate this, thanks.

To explain the variation from your approach that you will find in my
queue now: Letting the script generate two files in one run is very
unhandy when defining the Makefile rules. So I now went for a two-stage
generation via awk that spits out two different macros the tables can use.

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
  2015-07-16 18:42                                       ` Jan Kiszka
@ 2015-07-16 22:34                                         ` Gilles Chanteperdrix
  2015-07-17  6:06                                           ` Jan Kiszka
  0 siblings, 1 reply; 28+ messages in thread
From: Gilles Chanteperdrix @ 2015-07-16 22:34 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai

On Thu, Jul 16, 2015 at 08:42:23PM +0200, Jan Kiszka wrote:
> On 2015-07-16 14:35, Jan Kiszka wrote:
> > On 2015-07-03 14:38, Gilles Chanteperdrix wrote:
> >> On Fri, Jul 03, 2015 at 02:31:25PM +0200, Gilles Chanteperdrix wrote:
> >>> On Fri, Jul 03, 2015 at 12:51:49PM +0200, Gilles Chanteperdrix wrote:
> >>>>> index 0000000..36b1e69
> >>>>> --- /dev/null
> >>>>> +++ b/kernel/cobalt/posix/gen-syscall-entries.sh
> >>>>> @@ -0,0 +1,24 @@
> >>>>> +#! /bin/sh
> >>>>> +
> >>>>> +set -e
> >>>>> +
> >>>>> +shift
> >>>>> +
> >>>>> +echo "#ifdef COBALT_LIST_CALL_ENTRIES"
> >>>>> +awk '
> >>>>> +match($0, /COBALT_SYSCALL\([^,]*, [^,]*/)  {
> >>>>> +	str=substr($0, RSTART + 15, RLENGTH - 15)
> >>>>> +	match(str, /[^,]*/)
> >>>>> +	print "__COBALT_CALL_ENTRY(" substr(str, RSTART, RLENGTH) ")"
> >>>>> +}
> >>>>> +' $*
> >>>>> +echo "#endif"
> >>>>> +
> >>>>> +echo "#ifdef COBALT_LIST_MODES"
> >>>>> +awk '
> >>>>> +match($0, /COBALT_SYSCALL\([^,]*, [^,]*/)  {
> >>>>> +	str=substr($0, RSTART + 15, RLENGTH - 15)
> >>>>> +	print "__COBALT_MODE(" str ")"
> >>>>> +}
> >>>>> +' $*
> >>>>> +echo "#endif"
> >>>>
> >>>> This is particularly inelegant:
> >>>> - you do not need awk to do that, sed is sufficient
> >>>> - with using awk, you can generate the two files in one pass, and
> >>>> remove the #ifdefs trick;
> >>>> - I think the awk script should at least generate an error in case
> >>>> of parser error
> >>>>
> >>>> I will submit an awk script which does that.
> >>>
> >>> Ok, another awk script which does that:
> >>>
> >>> BEGIN {
> >>> 	system("rm -f syscalls_modes.h syscalls_entries.h")
> >>> }
> >>>
> >>> match($0, /COBALT_SYSCALL\([^,]*,[ \t]*[^,]*/)  {
> >>> 	str=substr($0, RSTART + 15, RLENGTH - 15)
> >>> 	match(str, /[^, \t]*/)
> >>> 	syscall=substr(str, RSTART, RLENGTH)
> >>>
> >>> 	if (syscall == "") {
> >>> 		print "Failed to find syscall name in line " $0
> >>> 		exit 1
> >>> 	}
> >>>
> >>> 	print "__COBALT_MODE(" str ")," >> "syscalls_modes.h"
> >>> 	print "__COBALT_CALL_ENTRY(" syscall ")," >> "syscalls_entries.h"
> >>> 	next
> >>> }
> >>>
> >>> /COBALT_SYSCALL\(/  {
> >>> 	print "Failed to parse line " $0
> >>> 	exit 1
> >>> }
> >>>
> >>> It supposes it is running from the output directory, but we can pass
> >>> the output directory as a parameter if you prefer.
> >>
> >> Note that the simplistic approach taken precludes the use of
> >> conditional compilation with syscall definitions.
> > 
> > I'll parametrize and integrate this, thanks.
> 
> To explain the variation from your approach that you will find in my
> queue now: Letting the script generate two files in one run is very
> unhandy when defining the Makefile rules. So I now went for a two-stage
> generation via awk that spits out two different macros the tables
> can use.

Looks like nonsense to me. 

foo bar: foo.awk 

works with GNU make as far as I know

-- 
					    Gilles.
https://click-hack.org


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
  2015-07-16 22:34                                         ` Gilles Chanteperdrix
@ 2015-07-17  6:06                                           ` Jan Kiszka
  2015-07-17  7:23                                             ` Gilles Chanteperdrix
  0 siblings, 1 reply; 28+ messages in thread
From: Jan Kiszka @ 2015-07-17  6:06 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai

On 2015-07-17 00:34, Gilles Chanteperdrix wrote:
>> To explain the variation from your approach that you will find in my
>> queue now: Letting the script generate two files in one run is very
>> unhandy when defining the Makefile rules. So I now went for a two-stage
>> generation via awk that spits out two different macros the tables
>> can use.
> 
> Looks like nonsense to me. 

That's not necessary.

> 
> foo bar: foo.awk 
> 
> works with GNU make as far as I know
> 

Sure, but foo.awk is called only with foo or bar as target, so you can't
parametrize it and have to hard-code the outputs. Moreover, if running
parallel builds, make can decide to start both target generations at the
same time because it cannot see that running only one will already
magically generate the other.

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL
  2015-07-17  6:06                                           ` Jan Kiszka
@ 2015-07-17  7:23                                             ` Gilles Chanteperdrix
  0 siblings, 0 replies; 28+ messages in thread
From: Gilles Chanteperdrix @ 2015-07-17  7:23 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai

On Fri, Jul 17, 2015 at 08:06:04AM +0200, Jan Kiszka wrote:
> On 2015-07-17 00:34, Gilles Chanteperdrix wrote:
> >> To explain the variation from your approach that you will find in my
> >> queue now: Letting the script generate two files in one run is very
> >> unhandy when defining the Makefile rules. So I now went for a two-stage
> >> generation via awk that spits out two different macros the tables
> >> can use.
> > 
> > Looks like nonsense to me. 
> 
> That's not necessary.
> 
> > 
> > foo bar: foo.awk 
> > 
> > works with GNU make as far as I know
> > 
> 
> Sure, but foo.awk is called only with foo or bar as target, so you can't
> parametrize it and have to hard-code the outputs. Moreover, if running
> parallel builds, make can decide to start both target generations at the
> same time because it cannot see that running only one will already
> magically generate the other.

Ok, thought this syntax meant that the rule would generate the two targets at
once, and make knew that and would run the rule only once. It works
like that when running make without -j because make will not run the
rule twice because the second file was created by the first run and
so has the proper date, but -j breaks that indeed.

-- 
					    Gilles.
https://click-hack.org


^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2015-07-17  7:23 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <E1ZAgI1-0000jO-Kb@sd-51317.xenomai.org>
2015-07-02 15:24 ` [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/kernel: Remove unused mode parameter from COBALT_SYSCALL Philippe Gerum
2015-07-02 15:39   ` Jan Kiszka
2015-07-02 16:30     ` Philippe Gerum
2015-07-02 16:44       ` Jan Kiszka
2015-07-02 16:49         ` Gilles Chanteperdrix
2015-07-02 16:56           ` Philippe Gerum
2015-07-02 17:03             ` Gilles Chanteperdrix
2015-07-02 17:09               ` Philippe Gerum
2015-07-02 16:56           ` Gilles Chanteperdrix
2015-07-02 17:31             ` Jan Kiszka
2015-07-02 17:35               ` Gilles Chanteperdrix
2015-07-02 17:55                 ` Gilles Chanteperdrix
2015-07-02 17:57                   ` Jan Kiszka
2015-07-02 18:00                     ` Gilles Chanteperdrix
2015-07-02 18:42                     ` Gilles Chanteperdrix
2015-07-02 18:49                       ` Jan Kiszka
2015-07-02 18:55                         ` Gilles Chanteperdrix
2015-07-02 19:32                           ` Jan Kiszka
2015-07-02 20:26                             ` Jan Kiszka
2015-07-03 10:51                               ` Gilles Chanteperdrix
2015-07-03 12:31                                 ` Gilles Chanteperdrix
2015-07-03 12:38                                   ` Gilles Chanteperdrix
2015-07-16 12:35                                     ` Jan Kiszka
2015-07-16 18:42                                       ` Jan Kiszka
2015-07-16 22:34                                         ` Gilles Chanteperdrix
2015-07-17  6:06                                           ` Jan Kiszka
2015-07-17  7:23                                             ` Gilles Chanteperdrix
2015-07-16 12:34                                 ` Jan Kiszka

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.