From: Jan Kiszka <jan.kiszka@siemens.com>
To: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
Cc: Xenomai <xenomai@xenomai.org>
Subject: Re: [Xenomai] Issue with CONFIG_PREEMPT_VOLUNTARY
Date: Mon, 12 Oct 2015 10:58:58 +0200 [thread overview]
Message-ID: <561B7652.30508@siemens.com> (raw)
In-Reply-To: <20151012084846.GB23413@hermes.click-hack.org>
On 2015-10-12 10:48, Gilles Chanteperdrix wrote:
> On Mon, Oct 12, 2015 at 10:37:50AM +0200, Jan Kiszka wrote:
>> On 2015-10-12 10:10, Gilles Chanteperdrix wrote:
>>> On Mon, Oct 12, 2015 at 09:23:46AM +0200, Jan Kiszka wrote:
>>>> On 2015-10-11 15:05, Gilles Chanteperdrix wrote:
>>>>> Hi,
>>>>>
>>>>> It seems commit fdb5d54d04b8c3b6b6a6ad7ac2b6248cf0b415e0 in the
>>>>> I-pipe kernels cause a warning when CONFIG_PREEMPT_VOLUNTARY and
>>>>> CONFIG_IPIPE_DEBUG_INTERNAL are enabled. The culprit is the call to
>>>>> __ipipe_root_p.
>>>>
>>>> Compiler warning? Runtime warning? Which architecture? I assume that
>>>> ftrace is on then, right?
>>>
>>> Yes. Because preempt_disable()/preempt_enable*() is a nop without
>>> CONFIG_PREEMPT_COUNT, __ipipe_root_p ends up being called without
>>> any protection, and __ipipe_check_percpu_access() emits the warning.
>>>
>>
>> Makes sense.
>>
>>>>
>>>>>
>>>>> The following patch avoids this warning:
>>>>
>>>> How?
>>>
>>> It disables the test for preemption (the call to preempt_count()) in
>>> __ipipe_check_percpu_access() if CONFIG_PREEMPT_COUNT is disabled,
>>> because if it is disabled, you can not be preempted anywhere, so
>>> calling __ipipe_root_p without protection is valid. Or maybe not?
>>
>> Ah, ok. I was under the assumption preempt_count() would return a
>> constant non-zero value under !CONFIG_PREEMPT. But on the other hand,
>> that would be weird as well when triggering voluntary preemption then.
>>
>> Anyway, it's correct that preemption cannot happen then in the middle of
>> an instruction, so we can skip the test. Please make the test depend on
>> CONFIG_PREEMPT and leave a corresponding comment in the code.
>
> maybe we could use preemptible()?
>
> it should test both the stall flag and preempt_count with
> CONFIG_PREEMPT_COUNT and returns 0 without CONFIG_PREEMPT_COUNT.
Indeed, even better. And self-documenting.
Jan
--
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux
next prev parent reply other threads:[~2015-10-12 8:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-11 13:05 [Xenomai] Issue with CONFIG_PREEMPT_VOLUNTARY Gilles Chanteperdrix
2015-10-12 7:23 ` Jan Kiszka
2015-10-12 8:10 ` Gilles Chanteperdrix
2015-10-12 8:37 ` Jan Kiszka
2015-10-12 8:48 ` Gilles Chanteperdrix
2015-10-12 8:58 ` Jan Kiszka [this message]
2015-10-12 17:40 ` [Xenomai] [PATCH 1/2] ipipe: simplify __ipipe_check_perccpu_access() Gilles Chanteperdrix
2015-10-12 17:40 ` [Xenomai] [PATCH 2/2] ipipe: fix __ipipe_check_percpu_access() Gilles Chanteperdrix
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=561B7652.30508@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=gilles.chanteperdrix@xenomai.org \
--cc=xenomai@xenomai.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.