All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Jan Kiszka <jan.kiszka@siemens.com>,
	Henning Schild <henning.schild@siemens.com>
Cc: Xenomai <xenomai@xenomai.org>
Subject: Re: [Xenomai] [PATCH] ipipe x86 mm: handle huge pages in memory pinning
Date: Wed, 27 Jan 2016 11:44:56 +0100	[thread overview]
Message-ID: <56A89FA8.3010306@xenomai.org> (raw)
In-Reply-To: <56A89C77.9050105@siemens.com>

On 01/27/2016 11:31 AM, Jan Kiszka wrote:
> On 2016-01-27 10:54, Henning Schild wrote:
>> On Tue, 26 Jan 2016 21:18:53 +0100
>> Jan Kiszka <jan.kiszka@siemens.com> wrote:
>>
>>> On 2016-01-26 16:20, Henning Schild wrote:
>>>> In 4.1 huge page mapping of io memory was introduced, enable ipipe
>>>> to handle that when pinning kernel memory.
>>>>
>>>> change that introduced the feature
>>>> 0f616be120c632c818faaea9adcb8f05a7a8601f
>>>>
>>>> Signed-off-by: Henning Schild <henning.schild@siemens.com>
>>>> ---
>>>>  arch/x86/mm/fault.c | 16 ++++++++++++++++
>>>>  1 file changed, 16 insertions(+)
>>>>
>>>> diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
>>>> index fd5bbcc..5585610 100644
>>>> --- a/arch/x86/mm/fault.c
>>>> +++ b/arch/x86/mm/fault.c
>>>> @@ -211,11 +211,19 @@ static inline pmd_t *vmalloc_sync_one(pgd_t
>>>> *pgd, unsigned long address) pud_k = pud_offset(pgd_k, address);
>>>>  	if (!pud_present(*pud_k))
>>>>  		return NULL;
>>>> +#if defined(CONFIG_IPIPE) && defined(CONFIG_HAVE_ARCH_HUGE_VMAP)
>>>> +	if (pud_large(*pud))
>>>> +		return pud_k;
>>>> +#endif
>>>>  
>>>>  	pmd = pmd_offset(pud, address);
>>>>  	pmd_k = pmd_offset(pud_k, address);
>>>>  	if (!pmd_present(*pmd_k))
>>>>  		return NULL;
>>>> +#if defined(CONFIG_IPIPE) && defined(CONFIG_HAVE_ARCH_HUGE_VMAP)
>>>> +	if (pmd_large(*pmd))
>>>> +		return pmd_k;
>>>> +#endif
>>>>  
>>>>  	if (!pmd_present(*pmd))
>>>>  		set_pmd(pmd, *pmd_k);
>>>> @@ -400,6 +408,10 @@ static inline int vmalloc_sync_one(pgd_t *pgd,
>>>> unsigned long address) 
>>>>  	if (pud_none(*pud) || pud_page_vaddr(*pud) !=
>>>> pud_page_vaddr(*pud_ref)) BUG();
>>>> +#if defined(CONFIG_IPIPE) && defined(CONFIG_HAVE_ARCH_HUGE_VMAP)
>>>> +	if (pud_large(*pud))
>>>> +		return 0;
>>>> +#endif
>>>>  
>>>>  	pmd = pmd_offset(pud, address);
>>>>  	pmd_ref = pmd_offset(pud_ref, address);
>>>> @@ -408,6 +420,10 @@ static inline int vmalloc_sync_one(pgd_t *pgd,
>>>> unsigned long address) 
>>>>  	if (pmd_none(*pmd) || pmd_page(*pmd) != pmd_page(*pmd_ref))
>>>>  		BUG();
>>>> +#if defined(CONFIG_IPIPE) && defined(CONFIG_HAVE_ARCH_HUGE_VMAP)
>>>> +	if (pmd_large(*pmd))
>>>> +		return 0;
>>>> +#endif
>>>>  
>>>>  	pte_ref = pte_offset_kernel(pmd_ref, address);
>>>>  	if (!pte_present(*pte_ref))
>>>>   
>>>
>>> Do we need the #ifdefs? If not, maybe just leave comments to establish
>>> the relationship to I-pipe.
>>
>> We do not, without ipipe the function is never called from a
>> context where that check is required. If it was, this change or
>> something similar would be in mainline.
>> I see the ifdefs as kind of comments that establish the relationship to
>> ipipe and the huge_vmap feature. Plus in all other cases a pointless
>> check is not even compiled in.
>> If comments should be used instead of ifdefs i will change that.
> 
> The optimal way of documenting the motivation for these changes is in a
> changelog. Provided the patch will survive future I-pipe versions and
> not be folded into a bigger patch (Philippe, please confirm),

In the current workflow, only raw/* branches may be rebased, so folding
patches within a maintenance branch can't happen.

 let's go
> for that. Plan B is inline comments. But #ifdefs for documentation
> purposes are not desirable.
> 

Documentation is best when close to the documented code, so to me plan B
is actually plan A, although I agree that complex/tricky/non-obvious
matters addressed by any given patch should be described accurately in
its changelog.

-- 
Philippe.


  reply	other threads:[~2016-01-27 10:44 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
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 [this message]
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=56A89FA8.3010306@xenomai.org \
    --to=rpm@xenomai.org \
    --cc=henning.schild@siemens.com \
    --cc=jan.kiszka@siemens.com \
    --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.