From: Philippe Gerum <rpm@xenomai.org>
To: Henning Schild <henning.schild@siemens.com>
Cc: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>,
Xenomai@xenomai.org
Subject: Re: [Xenomai] ipipe x86_64 huge page ioremap
Date: Wed, 3 Feb 2016 16:07:57 +0100 [thread overview]
Message-ID: <56B217CD.9020805@xenomai.org> (raw)
In-Reply-To: <20160202184310.505cf6be@md1em3qc>
On 02/02/2016 06:43 PM, Henning Schild wrote:
> On Fri, 15 Jan 2016 09:32:38 +0100
> Philippe Gerum <rpm@xenomai.org> wrote:
>
>> On 01/14/2016 06:34 PM, Henning Schild wrote:
>>> Hey,
>>>
>>> the 4.1 kernel supports mapping IO memory using huge pages.
>>> 0f616be120c632c818faaea9adcb8f05a7a8601f ..
>>> 6b6378355b925050eb6fa966742d8c2d65ff0d83
>>>
>>> In ipipe memory that gets ioremapped will get pinned using
>>> __ipipe_pin_mapping_globally, however in the x86_64 case that
>>> function uses vmalloc_sync_one which must only be used on 4k pages.
>>>
>>> We found the problem when using the kernel in a VBox VM, where the
>>> paravirtualized PCI device has enough iomem to cause huge page
>>> mappings. When loading the device driver you will get a BUG caused
>>> by __ipipe_pin_mapping_globally.
>>>
>>> I will work on a fix for the problem. But i would also like to
>>> understand the initial purpose of the pinning. Is it even supposed
>>> to work for io memory as well? It looks like a way to commit
>>> address space changes right down into the page tables, to avoid
>>> page-faults in the kernel address space. Probably for more
>>> predictable timing ...
>>
>> This is for pinning the page table entries referencing kernel
>> mappings, so that we don't get minor faults when treading over kernel
>> memory, unless the fault fixup code is compatible with primary domain
>> execution, and cheaper than tracking the pgds.
>
> Looking at both users of the pinning vmalloc and ioremap it does not
> seem to me like anything is done lazy here. The complete pagetables are
> alloced and filled.
> Maybe i am reading it wrong, maybe the kernel changed since the pinning
> function was introduced, or something else. Could you please explain
> what minor faults we are talking about?
>
> Faults on the actual content or faults on the PTs? After all they need
> to be mapped in order to read/change them.
minor faults: MMU traps occurring when the page is in-core, but not
indexed by the pgd/TLB, due to a lazy/ondemand mapping scheme or lack of
resources. This mechanism is typically used with vmalloc'ed memory,
which underlies kernel modules.
1. A Xenomai activity preempts whatever linux context, borrowing the
current mm
2. That activity refers to some memory which is not mapped into the
current mm.
3. Minor fault
Now, whether a minor fault is acceptable or not latency-wise depends on
what has to be done for fixing up the current context: specifically we
must be able to handle the trap immediately without having to wait for
reentering the regular linux context.
On x86, it's not acceptable so we have to pin those mappings a rt
activity might tread on into every mm. Usually, TLB miss handlers for
ppc32/ppc64 can be specifically "ironed", so that we don't have to
downgrade to linux mode for handling those traps. Some ARM families such
as imx6 look ok too these days, hence the recent dropping of pte pinning
for kernel mappings there. Likewise for arm64.
Since you mentioned a patch dating back to 2007, here is a discussion
illustrating the issue from the same period:
https://xenomai.org/pipermail/xenomai/2007-February/007383.html
--
Philippe.
next prev parent reply other threads:[~2016-02-03 15:07 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-14 17:34 [Xenomai] ipipe x86_64 huge page ioremap Henning Schild
2016-01-15 8:32 ` Philippe Gerum
2016-01-15 12:34 ` Jan Kiszka
2016-02-02 17:43 ` Henning Schild
2016-02-03 15:07 ` Philippe Gerum [this message]
2016-02-03 15:48 ` Philippe Gerum
2016-02-04 11:43 ` Henning Schild
2016-01-26 15:20 ` [Xenomai] [PATCH] ipipe x86 mm: handle huge pages in memory pinning Henning Schild
2016-01-26 20:18 ` Jan Kiszka
2016-01-27 9:54 ` Henning Schild
2016-01-27 10:31 ` Jan Kiszka
2016-01-27 10:44 ` Philippe Gerum
2016-01-27 10:46 ` Philippe Gerum
2016-01-27 13:41 ` [Xenomai] [PATCH v2] " Henning Schild
2016-01-28 10:53 ` Philippe Gerum
2016-01-28 20:53 ` Henning Schild
2016-01-29 17:11 ` Philippe Gerum
2016-01-29 18:39 ` Gilles Chanteperdrix
2016-02-02 12:08 ` Henning Schild
2016-02-02 13:58 ` Philippe Gerum
2016-02-02 16:38 ` Henning Schild
2016-02-02 16:39 ` Jan Kiszka
2016-02-02 19:26 ` Gilles Chanteperdrix
2016-02-03 11:35 ` Henning Schild
2016-02-02 14:18 ` Philippe Gerum
2016-02-02 16:30 ` Henning Schild
2016-02-02 11:41 ` Henning Schild
2016-02-03 12:59 ` [Xenomai] [PATCH v3] " Henning Schild
2016-02-03 14:24 ` Gilles Chanteperdrix
2016-02-03 14:31 ` Jan Kiszka
2016-02-03 14:38 ` Gilles Chanteperdrix
2016-02-03 14:51 ` Jan Kiszka
2016-02-03 15:02 ` Gilles Chanteperdrix
2016-02-03 15:14 ` Jan Kiszka
2016-02-04 11:53 ` Henning Schild
2016-02-08 8:44 ` Henning Schild
2016-03-07 7:58 ` Henning Schild
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=56B217CD.9020805@xenomai.org \
--to=rpm@xenomai.org \
--cc=Xenomai@xenomai.org \
--cc=gilles.chanteperdrix@xenomai.org \
--cc=henning.schild@siemens.com \
/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.