* [Xenomai] Xenomai 3: kill() to non-Xenomai PIDs
@ 2015-10-16 14:49 Jan Kiszka
2015-10-16 14:56 ` Jan Kiszka
0 siblings, 1 reply; 12+ messages in thread
From: Jan Kiszka @ 2015-10-16 14:49 UTC (permalink / raw)
To: Xenomai
Hi,
kill() is currently handled by libcobalt such that PIDs <= 0 are
forwarded to Linux and PIDs > 0 are considered to target only Xenomai
threads. But what if the user wants to address a regular Linux task from
within a Xenomai application? Shouldn't we retry kill via the Linux path
if Xenomai's syscall reports ESRCH?
Jan
--
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Xenomai] Xenomai 3: kill() to non-Xenomai PIDs
2015-10-16 14:49 [Xenomai] Xenomai 3: kill() to non-Xenomai PIDs Jan Kiszka
@ 2015-10-16 14:56 ` Jan Kiszka
2015-10-16 15:22 ` Philippe Gerum
0 siblings, 1 reply; 12+ messages in thread
From: Jan Kiszka @ 2015-10-16 14:56 UTC (permalink / raw)
To: Xenomai
On 2015-10-16 16:49, Jan Kiszka wrote:
> Hi,
>
> kill() is currently handled by libcobalt such that PIDs <= 0 are
> forwarded to Linux and PIDs > 0 are considered to target only Xenomai
> threads. But what if the user wants to address a regular Linux task from
> within a Xenomai application? Shouldn't we retry kill via the Linux path
> if Xenomai's syscall reports ESRCH?
>
IOW:
diff --git a/lib/cobalt/signal.c b/lib/cobalt/signal.c
index aac4059..7e03301 100644
--- a/lib/cobalt/signal.c
+++ b/lib/cobalt/signal.c
@@ -99,6 +99,10 @@ COBALT_IMPL(int, kill, (pid_t pid, int sig))
ret = XENOMAI_SYSCALL2(sc_cobalt_kill, pid, sig);
if (ret) {
+ /* Retry with regular kill is no RT target was found. */
+ if (ret == -ESRCH)
+ return __STD(kill(pid, sig));
+
errno = -ret;
return -1;
}
Jan
--
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [Xenomai] Xenomai 3: kill() to non-Xenomai PIDs
2015-10-16 14:56 ` Jan Kiszka
@ 2015-10-16 15:22 ` Philippe Gerum
2015-10-16 15:28 ` Jan Kiszka
0 siblings, 1 reply; 12+ messages in thread
From: Philippe Gerum @ 2015-10-16 15:22 UTC (permalink / raw)
To: Jan Kiszka, Xenomai
On 10/16/2015 04:56 PM, Jan Kiszka wrote:
> On 2015-10-16 16:49, Jan Kiszka wrote:
>> Hi,
>>
>> kill() is currently handled by libcobalt such that PIDs <= 0 are
>> forwarded to Linux and PIDs > 0 are considered to target only Xenomai
>> threads. But what if the user wants to address a regular Linux task from
>> within a Xenomai application? Shouldn't we retry kill via the Linux path
>> if Xenomai's syscall reports ESRCH?
>>
>
> IOW:
>
> diff --git a/lib/cobalt/signal.c b/lib/cobalt/signal.c
> index aac4059..7e03301 100644
> --- a/lib/cobalt/signal.c
> +++ b/lib/cobalt/signal.c
> @@ -99,6 +99,10 @@ COBALT_IMPL(int, kill, (pid_t pid, int sig))
>
> ret = XENOMAI_SYSCALL2(sc_cobalt_kill, pid, sig);
> if (ret) {
> + /* Retry with regular kill is no RT target was found. */
> + if (ret == -ESRCH)
> + return __STD(kill(pid, sig));
> +
> errno = -ret;
> return -1;
> }
>
> Jan
>
This may break code that sends signal 0 to detect whether a rt thread
exists (like copperplate does), which is the reason for the lack of
forwarding IIRC. (ret == -ESRCH && sig) would be required to forward
without breaking such assumption.
--
Philippe.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Xenomai] Xenomai 3: kill() to non-Xenomai PIDs
2015-10-16 15:22 ` Philippe Gerum
@ 2015-10-16 15:28 ` Jan Kiszka
2015-10-16 15:31 ` Philippe Gerum
2015-10-16 15:34 ` Gilles Chanteperdrix
0 siblings, 2 replies; 12+ messages in thread
From: Jan Kiszka @ 2015-10-16 15:28 UTC (permalink / raw)
To: Philippe Gerum, Xenomai
On 2015-10-16 17:22, Philippe Gerum wrote:
> On 10/16/2015 04:56 PM, Jan Kiszka wrote:
>> On 2015-10-16 16:49, Jan Kiszka wrote:
>>> Hi,
>>>
>>> kill() is currently handled by libcobalt such that PIDs <= 0 are
>>> forwarded to Linux and PIDs > 0 are considered to target only Xenomai
>>> threads. But what if the user wants to address a regular Linux task from
>>> within a Xenomai application? Shouldn't we retry kill via the Linux path
>>> if Xenomai's syscall reports ESRCH?
>>>
>>
>> IOW:
>>
>> diff --git a/lib/cobalt/signal.c b/lib/cobalt/signal.c
>> index aac4059..7e03301 100644
>> --- a/lib/cobalt/signal.c
>> +++ b/lib/cobalt/signal.c
>> @@ -99,6 +99,10 @@ COBALT_IMPL(int, kill, (pid_t pid, int sig))
>>
>> ret = XENOMAI_SYSCALL2(sc_cobalt_kill, pid, sig);
>> if (ret) {
>> + /* Retry with regular kill is no RT target was found. */
>> + if (ret == -ESRCH)
>> + return __STD(kill(pid, sig));
>> +
>> errno = -ret;
>> return -1;
>> }
>>
>> Jan
>>
>
> This may break code that sends signal 0 to detect whether a rt thread
> exists (like copperplate does), which is the reason for the lack of
> forwarding IIRC. (ret == -ESRCH && sig) would be required to forward
> without breaking such assumption.
That still breaks POSIX (what if the user wants to test for a non-rt
thread, like this is possible under regular Linux?). Can't copperplate
be changed to bypass the wrapper?
Jan
--
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Xenomai] Xenomai 3: kill() to non-Xenomai PIDs
2015-10-16 15:28 ` Jan Kiszka
@ 2015-10-16 15:31 ` Philippe Gerum
2015-10-16 15:57 ` Jan Kiszka
2015-10-16 15:34 ` Gilles Chanteperdrix
1 sibling, 1 reply; 12+ messages in thread
From: Philippe Gerum @ 2015-10-16 15:31 UTC (permalink / raw)
To: Jan Kiszka, Xenomai
On 10/16/2015 05:28 PM, Jan Kiszka wrote:
> On 2015-10-16 17:22, Philippe Gerum wrote:
>> On 10/16/2015 04:56 PM, Jan Kiszka wrote:
>>> On 2015-10-16 16:49, Jan Kiszka wrote:
>>>> Hi,
>>>>
>>>> kill() is currently handled by libcobalt such that PIDs <= 0 are
>>>> forwarded to Linux and PIDs > 0 are considered to target only Xenomai
>>>> threads. But what if the user wants to address a regular Linux task from
>>>> within a Xenomai application? Shouldn't we retry kill via the Linux path
>>>> if Xenomai's syscall reports ESRCH?
>>>>
>>>
>>> IOW:
>>>
>>> diff --git a/lib/cobalt/signal.c b/lib/cobalt/signal.c
>>> index aac4059..7e03301 100644
>>> --- a/lib/cobalt/signal.c
>>> +++ b/lib/cobalt/signal.c
>>> @@ -99,6 +99,10 @@ COBALT_IMPL(int, kill, (pid_t pid, int sig))
>>>
>>> ret = XENOMAI_SYSCALL2(sc_cobalt_kill, pid, sig);
>>> if (ret) {
>>> + /* Retry with regular kill is no RT target was found. */
>>> + if (ret == -ESRCH)
>>> + return __STD(kill(pid, sig));
>>> +
>>> errno = -ret;
>>> return -1;
>>> }
>>>
>>> Jan
>>>
>>
>> This may break code that sends signal 0 to detect whether a rt thread
>> exists (like copperplate does), which is the reason for the lack of
>> forwarding IIRC. (ret == -ESRCH && sig) would be required to forward
>> without breaking such assumption.
>
> That still breaks POSIX (what if the user wants to test for a non-rt
> thread, like this is possible under regular Linux?). Can't copperplate
> be changed to bypass the wrapper?
>
Probably, yes.
--
Philippe.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Xenomai] Xenomai 3: kill() to non-Xenomai PIDs
2015-10-16 15:28 ` Jan Kiszka
2015-10-16 15:31 ` Philippe Gerum
@ 2015-10-16 15:34 ` Gilles Chanteperdrix
2015-10-16 15:50 ` Jan Kiszka
1 sibling, 1 reply; 12+ messages in thread
From: Gilles Chanteperdrix @ 2015-10-16 15:34 UTC (permalink / raw)
To: Jan Kiszka; +Cc: Xenomai
On Fri, Oct 16, 2015 at 05:28:07PM +0200, Jan Kiszka wrote:
> On 2015-10-16 17:22, Philippe Gerum wrote:
> > On 10/16/2015 04:56 PM, Jan Kiszka wrote:
> >> On 2015-10-16 16:49, Jan Kiszka wrote:
> >>> Hi,
> >>>
> >>> kill() is currently handled by libcobalt such that PIDs <= 0 are
> >>> forwarded to Linux and PIDs > 0 are considered to target only Xenomai
> >>> threads. But what if the user wants to address a regular Linux task from
> >>> within a Xenomai application? Shouldn't we retry kill via the Linux path
> >>> if Xenomai's syscall reports ESRCH?
> >>>
> >>
> >> IOW:
> >>
> >> diff --git a/lib/cobalt/signal.c b/lib/cobalt/signal.c
> >> index aac4059..7e03301 100644
> >> --- a/lib/cobalt/signal.c
> >> +++ b/lib/cobalt/signal.c
> >> @@ -99,6 +99,10 @@ COBALT_IMPL(int, kill, (pid_t pid, int sig))
> >>
> >> ret = XENOMAI_SYSCALL2(sc_cobalt_kill, pid, sig);
> >> if (ret) {
> >> + /* Retry with regular kill is no RT target was found. */
> >> + if (ret == -ESRCH)
> >> + return __STD(kill(pid, sig));
> >> +
> >> errno = -ret;
> >> return -1;
> >> }
> >>
> >> Jan
> >>
> >
> > This may break code that sends signal 0 to detect whether a rt thread
> > exists (like copperplate does), which is the reason for the lack of
> > forwarding IIRC. (ret == -ESRCH && sig) would be required to forward
> > without breaking such assumption.
>
> That still breaks POSIX (what if the user wants to test for a non-rt
> thread, like this is possible under regular Linux?). Can't copperplate
> be changed to bypass the wrapper?
If I have understood the "xenomai 3" philosophy, is not an
application which wants to use the standard call supposed to use the
__STD prefix, or not use the wrapping at all ?
--
Gilles.
https://click-hack.org
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Xenomai] Xenomai 3: kill() to non-Xenomai PIDs
2015-10-16 15:34 ` Gilles Chanteperdrix
@ 2015-10-16 15:50 ` Jan Kiszka
0 siblings, 0 replies; 12+ messages in thread
From: Jan Kiszka @ 2015-10-16 15:50 UTC (permalink / raw)
To: Gilles Chanteperdrix; +Cc: Xenomai
On 2015-10-16 17:34, Gilles Chanteperdrix wrote:
> On Fri, Oct 16, 2015 at 05:28:07PM +0200, Jan Kiszka wrote:
>> On 2015-10-16 17:22, Philippe Gerum wrote:
>>> On 10/16/2015 04:56 PM, Jan Kiszka wrote:
>>>> On 2015-10-16 16:49, Jan Kiszka wrote:
>>>>> Hi,
>>>>>
>>>>> kill() is currently handled by libcobalt such that PIDs <= 0 are
>>>>> forwarded to Linux and PIDs > 0 are considered to target only Xenomai
>>>>> threads. But what if the user wants to address a regular Linux task from
>>>>> within a Xenomai application? Shouldn't we retry kill via the Linux path
>>>>> if Xenomai's syscall reports ESRCH?
>>>>>
>>>>
>>>> IOW:
>>>>
>>>> diff --git a/lib/cobalt/signal.c b/lib/cobalt/signal.c
>>>> index aac4059..7e03301 100644
>>>> --- a/lib/cobalt/signal.c
>>>> +++ b/lib/cobalt/signal.c
>>>> @@ -99,6 +99,10 @@ COBALT_IMPL(int, kill, (pid_t pid, int sig))
>>>>
>>>> ret = XENOMAI_SYSCALL2(sc_cobalt_kill, pid, sig);
>>>> if (ret) {
>>>> + /* Retry with regular kill is no RT target was found. */
>>>> + if (ret == -ESRCH)
>>>> + return __STD(kill(pid, sig));
>>>> +
>>>> errno = -ret;
>>>> return -1;
>>>> }
>>>>
>>>> Jan
>>>>
>>>
>>> This may break code that sends signal 0 to detect whether a rt thread
>>> exists (like copperplate does), which is the reason for the lack of
>>> forwarding IIRC. (ret == -ESRCH && sig) would be required to forward
>>> without breaking such assumption.
>>
>> That still breaks POSIX (what if the user wants to test for a non-rt
>> thread, like this is possible under regular Linux?). Can't copperplate
>> be changed to bypass the wrapper?
>
> If I have understood the "xenomai 3" philosophy, is not an
> application which wants to use the standard call supposed to use the
> __STD prefix, or not use the wrapping at all ?
That's also a theoretical option, but should only be used if we can't
fix the limitation otherwise. The more exceptions we define, the less
portable we become for POSIX/Linux applications.
Jan
--
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Xenomai] Xenomai 3: kill() to non-Xenomai PIDs
2015-10-16 15:31 ` Philippe Gerum
@ 2015-10-16 15:57 ` Jan Kiszka
2015-10-16 16:00 ` Philippe Gerum
0 siblings, 1 reply; 12+ messages in thread
From: Jan Kiszka @ 2015-10-16 15:57 UTC (permalink / raw)
To: Philippe Gerum, Xenomai
On 2015-10-16 17:31, Philippe Gerum wrote:
> On 10/16/2015 05:28 PM, Jan Kiszka wrote:
>> On 2015-10-16 17:22, Philippe Gerum wrote:
>>> On 10/16/2015 04:56 PM, Jan Kiszka wrote:
>>>> On 2015-10-16 16:49, Jan Kiszka wrote:
>>>>> Hi,
>>>>>
>>>>> kill() is currently handled by libcobalt such that PIDs <= 0 are
>>>>> forwarded to Linux and PIDs > 0 are considered to target only Xenomai
>>>>> threads. But what if the user wants to address a regular Linux task from
>>>>> within a Xenomai application? Shouldn't we retry kill via the Linux path
>>>>> if Xenomai's syscall reports ESRCH?
>>>>>
>>>>
>>>> IOW:
>>>>
>>>> diff --git a/lib/cobalt/signal.c b/lib/cobalt/signal.c
>>>> index aac4059..7e03301 100644
>>>> --- a/lib/cobalt/signal.c
>>>> +++ b/lib/cobalt/signal.c
>>>> @@ -99,6 +99,10 @@ COBALT_IMPL(int, kill, (pid_t pid, int sig))
>>>>
>>>> ret = XENOMAI_SYSCALL2(sc_cobalt_kill, pid, sig);
>>>> if (ret) {
>>>> + /* Retry with regular kill is no RT target was found. */
>>>> + if (ret == -ESRCH)
>>>> + return __STD(kill(pid, sig));
>>>> +
>>>> errno = -ret;
>>>> return -1;
>>>> }
>>>>
>>>> Jan
>>>>
>>>
>>> This may break code that sends signal 0 to detect whether a rt thread
>>> exists (like copperplate does), which is the reason for the lack of
>>> forwarding IIRC. (ret == -ESRCH && sig) would be required to forward
>>> without breaking such assumption.
>>
>> That still breaks POSIX (what if the user wants to test for a non-rt
>> thread, like this is possible under regular Linux?). Can't copperplate
>> be changed to bypass the wrapper?
>>
>
> Probably, yes.
>
Looking at cluster_probe, I wonder if there is actually a problem.
Doesn't that code also run over mercury? Then kill(pid, 0) also targets
the whole system, not just a set of Xenomai applications. Or do we need
to ensure that the caller is not migrated to Linux needlessly under
cobalt? IOW: can that probing happen under RT constraints?
The same applies for me to the other users of the kill-based probing
pattern (copperplate/heapobj-pshared.c and copperplate/regd/fs-common.c).
Jan
--
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Xenomai] Xenomai 3: kill() to non-Xenomai PIDs
2015-10-16 15:57 ` Jan Kiszka
@ 2015-10-16 16:00 ` Philippe Gerum
2015-10-16 16:03 ` Jan Kiszka
0 siblings, 1 reply; 12+ messages in thread
From: Philippe Gerum @ 2015-10-16 16:00 UTC (permalink / raw)
To: Jan Kiszka, Xenomai
On 10/16/2015 05:57 PM, Jan Kiszka wrote:
> On 2015-10-16 17:31, Philippe Gerum wrote:
>> On 10/16/2015 05:28 PM, Jan Kiszka wrote:
>>> On 2015-10-16 17:22, Philippe Gerum wrote:
>>>> On 10/16/2015 04:56 PM, Jan Kiszka wrote:
>>>>> On 2015-10-16 16:49, Jan Kiszka wrote:
>>>>>> Hi,
>>>>>>
>>>>>> kill() is currently handled by libcobalt such that PIDs <= 0 are
>>>>>> forwarded to Linux and PIDs > 0 are considered to target only Xenomai
>>>>>> threads. But what if the user wants to address a regular Linux task from
>>>>>> within a Xenomai application? Shouldn't we retry kill via the Linux path
>>>>>> if Xenomai's syscall reports ESRCH?
>>>>>>
>>>>>
>>>>> IOW:
>>>>>
>>>>> diff --git a/lib/cobalt/signal.c b/lib/cobalt/signal.c
>>>>> index aac4059..7e03301 100644
>>>>> --- a/lib/cobalt/signal.c
>>>>> +++ b/lib/cobalt/signal.c
>>>>> @@ -99,6 +99,10 @@ COBALT_IMPL(int, kill, (pid_t pid, int sig))
>>>>>
>>>>> ret = XENOMAI_SYSCALL2(sc_cobalt_kill, pid, sig);
>>>>> if (ret) {
>>>>> + /* Retry with regular kill is no RT target was found. */
>>>>> + if (ret == -ESRCH)
>>>>> + return __STD(kill(pid, sig));
>>>>> +
>>>>> errno = -ret;
>>>>> return -1;
>>>>> }
>>>>>
>>>>> Jan
>>>>>
>>>>
>>>> This may break code that sends signal 0 to detect whether a rt thread
>>>> exists (like copperplate does), which is the reason for the lack of
>>>> forwarding IIRC. (ret == -ESRCH && sig) would be required to forward
>>>> without breaking such assumption.
>>>
>>> That still breaks POSIX (what if the user wants to test for a non-rt
>>> thread, like this is possible under regular Linux?). Can't copperplate
>>> be changed to bypass the wrapper?
>>>
>>
>> Probably, yes.
>>
>
> Looking at cluster_probe, I wonder if there is actually a problem.
> Doesn't that code also run over mercury? Then kill(pid, 0) also targets
> the whole system, not just a set of Xenomai applications.
Over mercury, the whole system is the rt domain.
Or do we need
> to ensure that the caller is not migrated to Linux needlessly under
> cobalt? IOW: can that probing happen under RT constraints?
>
It does with clusters. In general, no restriction on the calling domain
should exist for this low level interface.
> The same applies for me to the other users of the kill-based probing
> pattern (copperplate/heapobj-pshared.c and copperplate/regd/fs-common.c).
>
> Jan
>
--
Philippe.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Xenomai] Xenomai 3: kill() to non-Xenomai PIDs
2015-10-16 16:00 ` Philippe Gerum
@ 2015-10-16 16:03 ` Jan Kiszka
2015-10-16 16:06 ` Philippe Gerum
0 siblings, 1 reply; 12+ messages in thread
From: Jan Kiszka @ 2015-10-16 16:03 UTC (permalink / raw)
To: Philippe Gerum, Xenomai
On 2015-10-16 18:00, Philippe Gerum wrote:
> On 10/16/2015 05:57 PM, Jan Kiszka wrote:
>> On 2015-10-16 17:31, Philippe Gerum wrote:
>>> On 10/16/2015 05:28 PM, Jan Kiszka wrote:
>>>> On 2015-10-16 17:22, Philippe Gerum wrote:
>>>>> On 10/16/2015 04:56 PM, Jan Kiszka wrote:
>>>>>> On 2015-10-16 16:49, Jan Kiszka wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> kill() is currently handled by libcobalt such that PIDs <= 0 are
>>>>>>> forwarded to Linux and PIDs > 0 are considered to target only Xenomai
>>>>>>> threads. But what if the user wants to address a regular Linux task from
>>>>>>> within a Xenomai application? Shouldn't we retry kill via the Linux path
>>>>>>> if Xenomai's syscall reports ESRCH?
>>>>>>>
>>>>>>
>>>>>> IOW:
>>>>>>
>>>>>> diff --git a/lib/cobalt/signal.c b/lib/cobalt/signal.c
>>>>>> index aac4059..7e03301 100644
>>>>>> --- a/lib/cobalt/signal.c
>>>>>> +++ b/lib/cobalt/signal.c
>>>>>> @@ -99,6 +99,10 @@ COBALT_IMPL(int, kill, (pid_t pid, int sig))
>>>>>>
>>>>>> ret = XENOMAI_SYSCALL2(sc_cobalt_kill, pid, sig);
>>>>>> if (ret) {
>>>>>> + /* Retry with regular kill is no RT target was found. */
>>>>>> + if (ret == -ESRCH)
>>>>>> + return __STD(kill(pid, sig));
>>>>>> +
>>>>>> errno = -ret;
>>>>>> return -1;
>>>>>> }
>>>>>>
>>>>>> Jan
>>>>>>
>>>>>
>>>>> This may break code that sends signal 0 to detect whether a rt thread
>>>>> exists (like copperplate does), which is the reason for the lack of
>>>>> forwarding IIRC. (ret == -ESRCH && sig) would be required to forward
>>>>> without breaking such assumption.
>>>>
>>>> That still breaks POSIX (what if the user wants to test for a non-rt
>>>> thread, like this is possible under regular Linux?). Can't copperplate
>>>> be changed to bypass the wrapper?
>>>>
>>>
>>> Probably, yes.
>>>
>>
>> Looking at cluster_probe, I wonder if there is actually a problem.
>> Doesn't that code also run over mercury? Then kill(pid, 0) also targets
>> the whole system, not just a set of Xenomai applications.
>
> Over mercury, the whole system is the rt domain.
>
> Or do we need
>> to ensure that the caller is not migrated to Linux needlessly under
>> cobalt? IOW: can that probing happen under RT constraints?
>>
>
> It does with clusters. In general, no restriction on the calling domain
> should exist for this low level interface.
Ok, will handle that path cobalt-specific then.
>
>> The same applies for me to the other users of the kill-based probing
>> pattern (copperplate/heapobj-pshared.c and copperplate/regd/fs-common.c).
But these are fine, no?
Jan
--
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Xenomai] Xenomai 3: kill() to non-Xenomai PIDs
2015-10-16 16:03 ` Jan Kiszka
@ 2015-10-16 16:06 ` Philippe Gerum
2015-10-16 16:07 ` Philippe Gerum
0 siblings, 1 reply; 12+ messages in thread
From: Philippe Gerum @ 2015-10-16 16:06 UTC (permalink / raw)
To: Jan Kiszka, Xenomai
On 10/16/2015 06:03 PM, Jan Kiszka wrote:
> On 2015-10-16 18:00, Philippe Gerum wrote:
>> On 10/16/2015 05:57 PM, Jan Kiszka wrote:
>>> On 2015-10-16 17:31, Philippe Gerum wrote:
>>>> On 10/16/2015 05:28 PM, Jan Kiszka wrote:
>>>>> On 2015-10-16 17:22, Philippe Gerum wrote:
>>>>>> On 10/16/2015 04:56 PM, Jan Kiszka wrote:
>>>>>>> On 2015-10-16 16:49, Jan Kiszka wrote:
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> kill() is currently handled by libcobalt such that PIDs <= 0 are
>>>>>>>> forwarded to Linux and PIDs > 0 are considered to target only Xenomai
>>>>>>>> threads. But what if the user wants to address a regular Linux task from
>>>>>>>> within a Xenomai application? Shouldn't we retry kill via the Linux path
>>>>>>>> if Xenomai's syscall reports ESRCH?
>>>>>>>>
>>>>>>>
>>>>>>> IOW:
>>>>>>>
>>>>>>> diff --git a/lib/cobalt/signal.c b/lib/cobalt/signal.c
>>>>>>> index aac4059..7e03301 100644
>>>>>>> --- a/lib/cobalt/signal.c
>>>>>>> +++ b/lib/cobalt/signal.c
>>>>>>> @@ -99,6 +99,10 @@ COBALT_IMPL(int, kill, (pid_t pid, int sig))
>>>>>>>
>>>>>>> ret = XENOMAI_SYSCALL2(sc_cobalt_kill, pid, sig);
>>>>>>> if (ret) {
>>>>>>> + /* Retry with regular kill is no RT target was found. */
>>>>>>> + if (ret == -ESRCH)
>>>>>>> + return __STD(kill(pid, sig));
>>>>>>> +
>>>>>>> errno = -ret;
>>>>>>> return -1;
>>>>>>> }
>>>>>>>
>>>>>>> Jan
>>>>>>>
>>>>>>
>>>>>> This may break code that sends signal 0 to detect whether a rt thread
>>>>>> exists (like copperplate does), which is the reason for the lack of
>>>>>> forwarding IIRC. (ret == -ESRCH && sig) would be required to forward
>>>>>> without breaking such assumption.
>>>>>
>>>>> That still breaks POSIX (what if the user wants to test for a non-rt
>>>>> thread, like this is possible under regular Linux?). Can't copperplate
>>>>> be changed to bypass the wrapper?
>>>>>
>>>>
>>>> Probably, yes.
>>>>
>>>
>>> Looking at cluster_probe, I wonder if there is actually a problem.
>>> Doesn't that code also run over mercury? Then kill(pid, 0) also targets
>>> the whole system, not just a set of Xenomai applications.
>>
>> Over mercury, the whole system is the rt domain.
>>
>> Or do we need
>>> to ensure that the caller is not migrated to Linux needlessly under
>>> cobalt? IOW: can that probing happen under RT constraints?
>>>
>>
>> It does with clusters. In general, no restriction on the calling domain
>> should exist for this low level interface.
>
> Ok, will handle that path cobalt-specific then.
>
>>
>>> The same applies for me to the other users of the kill-based probing
>>> pattern (copperplate/heapobj-pshared.c and copperplate/regd/fs-common.c).
>
> But these are fine, no?
>
Yes, don't care for mode switches there.
--
Philippe.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Xenomai] Xenomai 3: kill() to non-Xenomai PIDs
2015-10-16 16:06 ` Philippe Gerum
@ 2015-10-16 16:07 ` Philippe Gerum
0 siblings, 0 replies; 12+ messages in thread
From: Philippe Gerum @ 2015-10-16 16:07 UTC (permalink / raw)
To: Jan Kiszka, Xenomai
On 10/16/2015 06:06 PM, Philippe Gerum wrote:
> On 10/16/2015 06:03 PM, Jan Kiszka wrote:
>> On 2015-10-16 18:00, Philippe Gerum wrote:
>>> On 10/16/2015 05:57 PM, Jan Kiszka wrote:
>>>> On 2015-10-16 17:31, Philippe Gerum wrote:
>>>>> On 10/16/2015 05:28 PM, Jan Kiszka wrote:
>>>>>> On 2015-10-16 17:22, Philippe Gerum wrote:
>>>>>>> On 10/16/2015 04:56 PM, Jan Kiszka wrote:
>>>>>>>> On 2015-10-16 16:49, Jan Kiszka wrote:
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> kill() is currently handled by libcobalt such that PIDs <= 0 are
>>>>>>>>> forwarded to Linux and PIDs > 0 are considered to target only Xenomai
>>>>>>>>> threads. But what if the user wants to address a regular Linux task from
>>>>>>>>> within a Xenomai application? Shouldn't we retry kill via the Linux path
>>>>>>>>> if Xenomai's syscall reports ESRCH?
>>>>>>>>>
>>>>>>>>
>>>>>>>> IOW:
>>>>>>>>
>>>>>>>> diff --git a/lib/cobalt/signal.c b/lib/cobalt/signal.c
>>>>>>>> index aac4059..7e03301 100644
>>>>>>>> --- a/lib/cobalt/signal.c
>>>>>>>> +++ b/lib/cobalt/signal.c
>>>>>>>> @@ -99,6 +99,10 @@ COBALT_IMPL(int, kill, (pid_t pid, int sig))
>>>>>>>>
>>>>>>>> ret = XENOMAI_SYSCALL2(sc_cobalt_kill, pid, sig);
>>>>>>>> if (ret) {
>>>>>>>> + /* Retry with regular kill is no RT target was found. */
>>>>>>>> + if (ret == -ESRCH)
>>>>>>>> + return __STD(kill(pid, sig));
>>>>>>>> +
>>>>>>>> errno = -ret;
>>>>>>>> return -1;
>>>>>>>> }
>>>>>>>>
>>>>>>>> Jan
>>>>>>>>
>>>>>>>
>>>>>>> This may break code that sends signal 0 to detect whether a rt thread
>>>>>>> exists (like copperplate does), which is the reason for the lack of
>>>>>>> forwarding IIRC. (ret == -ESRCH && sig) would be required to forward
>>>>>>> without breaking such assumption.
>>>>>>
>>>>>> That still breaks POSIX (what if the user wants to test for a non-rt
>>>>>> thread, like this is possible under regular Linux?). Can't copperplate
>>>>>> be changed to bypass the wrapper?
>>>>>>
>>>>>
>>>>> Probably, yes.
>>>>>
>>>>
>>>> Looking at cluster_probe, I wonder if there is actually a problem.
>>>> Doesn't that code also run over mercury? Then kill(pid, 0) also targets
>>>> the whole system, not just a set of Xenomai applications.
>>>
>>> Over mercury, the whole system is the rt domain.
>>>
>>> Or do we need
>>>> to ensure that the caller is not migrated to Linux needlessly under
>>>> cobalt? IOW: can that probing happen under RT constraints?
>>>>
>>>
>>> It does with clusters. In general, no restriction on the calling domain
>>> should exist for this low level interface.
>>
>> Ok, will handle that path cobalt-specific then.
>>
>>>
>>>> The same applies for me to the other users of the kill-based probing
>>>> pattern (copperplate/heapobj-pshared.c and copperplate/regd/fs-common.c).
>>
>> But these are fine, no?
>>
>
> Yes, don't care for mode switches there.
>
>
In fact, those will never target a non-Xenomai thread over cobalt.
--
Philippe.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2015-10-16 16:07 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-16 14:49 [Xenomai] Xenomai 3: kill() to non-Xenomai PIDs Jan Kiszka
2015-10-16 14:56 ` Jan Kiszka
2015-10-16 15:22 ` Philippe Gerum
2015-10-16 15:28 ` Jan Kiszka
2015-10-16 15:31 ` Philippe Gerum
2015-10-16 15:57 ` Jan Kiszka
2015-10-16 16:00 ` Philippe Gerum
2015-10-16 16:03 ` Jan Kiszka
2015-10-16 16:06 ` Philippe Gerum
2015-10-16 16:07 ` Philippe Gerum
2015-10-16 15:34 ` Gilles Chanteperdrix
2015-10-16 15:50 ` 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.