All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Andi Kleen <ak@suse.de>
Cc: Ingo Molnar <mingo@elte.hu>, LKML <linux-kernel@vger.kernel.org>,
	Glauber de Oliveira Costa <glommer@gmail.com>,
	Jan Beulich <jbeulich@novell.com>
Subject: Re: [PATCH 00 of 10] x86: unify asm/pgtable.h
Date: Tue, 08 Jan 2008 19:22:46 -0800	[thread overview]
Message-ID: <47843E06.3070809@goop.org> (raw)
In-Reply-To: <20080109021124.GH25945@bingen.suse.de>

Andi Kleen wrote:
>> Yeah, that may be true, but this particular tree is weird, and I'm trying 
>> to understand what's going on here.  Specifically, 64-bit ioremap()s 
>> *don't* set _PAGE_GLOBAL, which appears to be an accident resulting from 
>> the strange definitions of __PAGE_KERNEL_* vs PAGE_KERNEL_*. 
>>     
>
> ioremap() should set G agreed.
>
>   
>> For example, ioremap_64.c:__ioremap() creates a vma for the io mapping, and 
>> explicitly sets _PAGE_GLOBAL in the vma's version of pgprot - but then it 
>> calls ioremap_page_range() to actually create the mapping, which ends up 
>> making a non-global mapping, because its rolling its own version of 
>> PAGE_KERNEL by using pgprot(__PAGE_KERNEL) - which is not the actual 
>> definition of PAGE_KERNEL.
>>     
>
> That should not really matter because ioremap_change_attr()->c_p_a is only called
> when flags is != 0 and that means it is already different from PAGE_KERNEL.
>
>   
>> I think there's a bug around here, but I think its currently being hidden 
>>     
>
> There's one Jan pointed out: iounmap does not subtract the guard page size
> so it ends up resetting one page too much. That is probably what causes your
> problem. But again you should be passing in G in the first place.
>
> -Andi
>
> Here was Jan's patch; it incidently fixes the G problem too
>   

OK, great.  Ingo, that means we can use this and go back to folding 
_PAGE_GLOBAL into __PAGE_KERNEL_*.  Well, at least give it a try.

    J

> snip
>
> Additionally I found it necessary to fix ioremap_64.c's use of
> change_page_attr_addr():
>
> --- a/arch/x86/mm/ioremap_64.c
> +++ b/arch/x86/mm/ioremap_64.c
> @@ -48,7 +48,7 @@ ioremap_change_attr(unsigned long phys_a
>   		 * Must use a address here and not struct page because the phys addr
>  		 * can be a in hole between nodes and not have an memmap entry.
>  		 */
> -		err = change_page_attr_addr(vaddr,npages,__pgprot(__PAGE_KERNEL|flags));
> +		err = change_page_attr_addr(vaddr,npages,MAKE_GLOBAL(__PAGE_KERNEL|flags));
>  		if (!err)
>  			global_flush_tlb();
>  	}
> @@ -199,7 +199,7 @@ void iounmap(volatile void __iomem *addr
>  
>  	/* Reset the direct mapping. Can block */
>  	if (p->flags >> 20)
> -		ioremap_change_attr(p->phys_addr, p->size, 0);
> +		ioremap_change_attr(p->phys_addr, get_vm_area_size(p), 0);
>  
>  	/* Finally remove it */
>  	o = remove_vm_area((void *)addr);
>
> Other extra changes I had in my version could possibly be counted as enhancements...
>
> Jan
>   


  reply	other threads:[~2008-01-09  3:24 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-08 22:00 [PATCH 00 of 10] x86: unify asm/pgtable.h Jeremy Fitzhardinge
2008-01-08 22:00 ` [PATCH 01 of 10] x86: move all asm/pgtable constants into one place Jeremy Fitzhardinge
2008-01-08 22:00 ` [PATCH 02 of 10] x86: avoid name conflict for Voyager leave_mm Jeremy Fitzhardinge
2008-01-08 22:00 ` [PATCH 03 of 10] x86/pgtable: unify pagetable accessors Jeremy Fitzhardinge
2008-01-08 22:00 ` [PATCH 04 of 10] x86: unify pgtable accessors which use supported_pte_mask Jeremy Fitzhardinge
2008-01-08 22:00 ` [PATCH 05 of 10] x86: page.h: make pte_t a union to always include pte element Jeremy Fitzhardinge
2008-01-08 22:00 ` [PATCH 06 of 10] x86/vmi: fix compilation as a result of pte_t changes Jeremy Fitzhardinge
2008-01-08 22:00 ` [PATCH 07 of 10] x86: pgtable: unify pte accessors Jeremy Fitzhardinge
2008-01-08 22:00 ` [PATCH 08 of 10] x86: unify zero_page definition Jeremy Fitzhardinge
2008-01-08 22:00 ` [PATCH 09 of 10] x86: unify paravirt pagetable accessors Jeremy Fitzhardinge
2008-01-08 22:00 ` [PATCH 10 of 10] xen: mask out PWT too Jeremy Fitzhardinge
2008-01-09  9:17   ` Jan Beulich
2008-01-09 19:04     ` Jeremy Fitzhardinge
2008-01-08 22:42 ` [PATCH 00 of 10] x86: unify asm/pgtable.h Ingo Molnar
2008-01-08 23:12   ` Ingo Molnar
2008-01-08 23:23     ` Jeremy Fitzhardinge
2008-01-08 23:28       ` Ingo Molnar
2008-01-08 23:44         ` Ingo Molnar
2008-01-08 23:51           ` Ingo Molnar
2008-01-09  0:01           ` Ingo Molnar
2008-01-09  0:13             ` Jeremy Fitzhardinge
2008-01-09  0:20               ` Ingo Molnar
2008-01-09  0:28                 ` Ingo Molnar
2008-01-09  0:30                   ` Ingo Molnar
2008-01-09  0:43                     ` Ingo Molnar
2008-01-09  0:55                       ` Jeremy Fitzhardinge
2008-01-09  1:09                       ` Jeremy Fitzhardinge
2008-01-09  1:16                         ` Ingo Molnar
2008-01-09  1:18                           ` Andi Kleen
2008-01-09  1:22                             ` Ingo Molnar
2008-01-09  1:37                               ` Andi Kleen
2008-01-09  1:21                           ` Jeremy Fitzhardinge
2008-01-09  1:37                             ` Ingo Molnar
2008-01-09  0:53                     ` Jeremy Fitzhardinge
2008-01-09  0:59                       ` Ingo Molnar
2008-01-09  1:07                         ` Jeremy Fitzhardinge
2008-01-09  1:12                           ` Andi Kleen
2008-01-09  1:20                             ` Ingo Molnar
2008-01-09  1:35                             ` Jeremy Fitzhardinge
2008-01-09  1:42                               ` Andi Kleen
2008-01-09  1:56                                 ` Jeremy Fitzhardinge
2008-01-09  2:11                                   ` Andi Kleen
2008-01-09  3:22                                     ` Jeremy Fitzhardinge [this message]
2008-01-09 10:48                                       ` Ingo Molnar
2008-01-09 10:47                                     ` Ingo Molnar
2008-01-09 14:26                                       ` Andi Kleen
2008-01-09  9:37                               ` Jan Beulich
2008-01-09  1:11                       ` Andi Kleen
2008-01-09  0:07         ` Jeremy Fitzhardinge

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=47843E06.3070809@goop.org \
    --to=jeremy@goop.org \
    --cc=ak@suse.de \
    --cc=glommer@gmail.com \
    --cc=jbeulich@novell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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.