LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [Lguest/x86]: Clash with ioremap_nocache() + _PAGE_PWT
@ 2008-02-06 23:21 Ahmed S. Darwish
  2008-02-06 23:59 ` Ingo Molnar
  0 siblings, 1 reply; 5+ messages in thread
From: Ahmed S. Darwish @ 2008-02-06 23:21 UTC (permalink / raw)
  To: Rusty Russel, Suresh Siddha, Ingo Molnar, Thomas Gleixner
  Cc: lguest, linux-kernel

Hi all,

Beginning from commit 4138cc3418f5, ioremap_nocache() sets the _PAGE_PWT
flag. 

Lguest doesn't accept a guest pte with a _PWT flag and reports a
"bad page table entry" in that case. 

I've removed check from lguest code and everything worked fine. 
Is this safe from the Lguest side ?

Mentioned commit [*]:

commit 4138cc3418f5eaa7524ff8e927102863f1ba0ea5
Author: Siddha, Suresh B <suresh.b.siddha@intel.com>
Date:   Wed Jan 30 13:33:43 2008 +0100

    x86: set strong uncacheable where UC is really desired
    
    Also use _PAGE_PWT for all the mappings which need uncache mapping.
    Instead of existing PAT2 which is UC- (and can be overwritten by MTRRs),
    we now use PAT3 which is strong uncacheable.
    
    This makes it consistent with pgprot_noncached()

diff --git a/arch/x86/mm/ioremap_32.c b/arch/x86/mm/ioremap_32.c
index 0b27831..ef0f6a4 100644
--- a/arch/x86/mm/ioremap_32.c
+++ b/arch/x86/mm/ioremap_32.c
@@ -119,7 +119,7 @@ EXPORT_SYMBOL(__ioremap);
 void __iomem *ioremap_nocache (unsigned long phys_addr, unsigned long size)
 {
 	unsigned long last_addr;
-	void __iomem *p = __ioremap(phys_addr, size, _PAGE_PCD);
+	void __iomem *p = __ioremap(phys_addr, size, _PAGE_PCD | _PAGE_PWT);
 	if (!p) 
 		return p; 

Thanks,

[*]: latest pull calls set_memory_uc() which also sets the _PWT flag.

--
Ahmed S. Darwish
Homepage: http://darwish.07.googlepages.com
Blog: http://darwish-07.blogspot.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Lguest/x86]: Clash with ioremap_nocache() + _PAGE_PWT
  2008-02-06 23:21 [Lguest/x86]: Clash with ioremap_nocache() + _PAGE_PWT Ahmed S. Darwish
@ 2008-02-06 23:59 ` Ingo Molnar
  2008-02-07  0:51   ` [PATCH] lguest: Accept guest _PAGE_PWT page table entries Ahmed S. Darwish
  0 siblings, 1 reply; 5+ messages in thread
From: Ingo Molnar @ 2008-02-06 23:59 UTC (permalink / raw)
  To: Ahmed S. Darwish
  Cc: Rusty Russel, Suresh Siddha, Thomas Gleixner, lguest, linux-kernel


* Ahmed S. Darwish <darwish.07@gmail.com> wrote:

> Hi all,
> 
> Beginning from commit 4138cc3418f5, ioremap_nocache() sets the _PAGE_PWT
> flag. 
> 
> Lguest doesn't accept a guest pte with a _PWT flag and reports a "bad 
> page table entry" in that case.
> 
> I've removed check from lguest code and everything worked fine. Is 
> this safe from the Lguest side ?

yes, should be safe. Could you send a patch so that others can apply it 
too?

	Ingo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] lguest: Accept guest _PAGE_PWT page table entries
  2008-02-06 23:59 ` Ingo Molnar
@ 2008-02-07  0:51   ` Ahmed S. Darwish
  2008-02-07  1:00     ` Ingo Molnar
  2008-03-04  1:37     ` Rusty Russell
  0 siblings, 2 replies; 5+ messages in thread
From: Ahmed S. Darwish @ 2008-02-07  0:51 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Rusty Russel, Suresh Siddha, Thomas Gleixner, lguest, linux-kernel

On Thu, Feb 07, 2008 at 12:59:23AM +0100, Ingo Molnar wrote:
> 
> * Ahmed S. Darwish <darwish.07@gmail.com> wrote:
> 
> > Hi all,
> > 
> > Beginning from commit 4138cc3418f5, ioremap_nocache() sets the _PAGE_PWT
> > flag. 
> > 
> > Lguest doesn't accept a guest pte with a _PWT flag and reports a "bad 
> > page table entry" in that case.
> > 
> > I've removed check from lguest code and everything worked fine. Is 
> > this safe from the Lguest side ?
> 
> yes, should be safe. Could you send a patch so that others can apply it 
> too?
> 

Ofcourse :) :

Accept guest _PAGE_PWT page table entries, otherwise lguest will
always fail with a "bad page table entry" message.

Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
---

diff --git a/drivers/lguest/page_tables.c b/drivers/lguest/page_tables.c
index 74b4cf2..952160b 100644
--- a/drivers/lguest/page_tables.c
+++ b/drivers/lguest/page_tables.c
@@ -178,8 +178,8 @@ static void release_pte(pte_t pte)
 
 static void check_gpte(struct lg_cpu *cpu, pte_t gpte)
 {
-	if ((pte_flags(gpte) & (_PAGE_PWT|_PAGE_PSE))
-	    || pte_pfn(gpte) >= cpu->lg->pfn_limit)
+	if ((pte_flags(gpte) & _PAGE_PSE) || 
+	    pte_pfn(gpte) >= cpu->lg->pfn_limit)
 		kill_guest(cpu, "bad page table entry");
 }
 

Regards,

--
Ahmed S. Darwish
Homepage: http://darwish.07.googlepages.com
Blog: http://darwish-07.blogspot.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] lguest: Accept guest _PAGE_PWT page table entries
  2008-02-07  0:51   ` [PATCH] lguest: Accept guest _PAGE_PWT page table entries Ahmed S. Darwish
@ 2008-02-07  1:00     ` Ingo Molnar
  2008-03-04  1:37     ` Rusty Russell
  1 sibling, 0 replies; 5+ messages in thread
From: Ingo Molnar @ 2008-02-07  1:00 UTC (permalink / raw)
  To: Ahmed S. Darwish
  Cc: Rusty Russel, Suresh Siddha, Thomas Gleixner, lguest, linux-kernel


* Ahmed S. Darwish <darwish.07@gmail.com> wrote:

> Ofcourse :) :
> 
> Accept guest _PAGE_PWT page table entries, otherwise lguest will 
> always fail with a "bad page table entry" message.

thanks - i've queued this up into x86.git. Rusty, is this fine to you, 
and should we nurse this fix upstream?

	Ingo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] lguest: Accept guest _PAGE_PWT page table entries
  2008-02-07  0:51   ` [PATCH] lguest: Accept guest _PAGE_PWT page table entries Ahmed S. Darwish
  2008-02-07  1:00     ` Ingo Molnar
@ 2008-03-04  1:37     ` Rusty Russell
  1 sibling, 0 replies; 5+ messages in thread
From: Rusty Russell @ 2008-03-04  1:37 UTC (permalink / raw)
  To: Ahmed S. Darwish
  Cc: Ingo Molnar, Suresh Siddha, Thomas Gleixner, lguest, linux-kernel

On Thursday 07 February 2008 11:51:20 Ahmed S. Darwish wrote:
> On Thu, Feb 07, 2008 at 12:59:23AM +0100, Ingo Molnar wrote:
> > yes, should be safe. Could you send a patch so that others can apply it
> > too?
>
> Ofcourse :) :
>
> Accept guest _PAGE_PWT page table entries, otherwise lguest will
> always fail with a "bad page table entry" message.
>
> Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>

Thanks for tracking this Ahmed, and thanks to Ingo for pushing it upstream.

Cheers,
Rusty.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-03-04  1:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-06 23:21 [Lguest/x86]: Clash with ioremap_nocache() + _PAGE_PWT Ahmed S. Darwish
2008-02-06 23:59 ` Ingo Molnar
2008-02-07  0:51   ` [PATCH] lguest: Accept guest _PAGE_PWT page table entries Ahmed S. Darwish
2008-02-07  1:00     ` Ingo Molnar
2008-03-04  1:37     ` Rusty Russell

This is a public inbox, see mirroring instructions
on how to clone and mirror all data and code used for this inbox