linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Query about set_pages_* API
@ 2008-02-09 22:40 Larry Finger
  2008-02-09 23:57 ` Arjan van de Ven
  2008-02-10  0:00 ` Arjan van de Ven
  0 siblings, 2 replies; 4+ messages in thread
From: Larry Finger @ 2008-02-09 22:40 UTC (permalink / raw)
  To: LKML

Is the set_pages_* API that replaces change_page_attr described somewhere? I have been unable to 
find it with Google.

I'm trying to modify the VirtualBox kernel module to work with 2.6.24-git (and 2.6.25) on x86_64 
architecture. The current code has a value of the third argument of the call (prot) with 3 variants. 
All variations have the following bits set: _PAGE_PRESENT, _PAGE_RW, _PAGE_DIRTY, and 
_PAGE_ACCESSED. Number 2 adds _PAGE_NX to the above, and number 3 adds _PAGE_GLOBAL to the bits in 
variation 1.

 From the code in arch/x86/mm/pageattr.c, I figured I need to call set_pages_wb() unconditionally, 
and set_pages_nx() if _PAGE_NX is set. Will these calls be sufficient? I thought about calling 
set_pages_rw(), but that entry is not exported.

Thanks,

Larry

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

* Re: Query about set_pages_* API
  2008-02-09 22:40 Query about set_pages_* API Larry Finger
@ 2008-02-09 23:57 ` Arjan van de Ven
  2008-02-10  0:00 ` Arjan van de Ven
  1 sibling, 0 replies; 4+ messages in thread
From: Arjan van de Ven @ 2008-02-09 23:57 UTC (permalink / raw)
  To: Larry Finger; +Cc: LKML

On Sat, 09 Feb 2008 15:40:12 -0700
Larry Finger <Larry.Finger@lwfinger.net> wrote:

> I'm trying to modify the VirtualBox kernel module to work with
> 2.6.24-git (and 2.6.25) on x86_64 architecture. The current code has
> a value of the third argument of the call (prot) with 3 variants. All
> variations have the following bits set: _PAGE_PRESENT, _PAGE_RW,
> _PAGE_DIRTY, and _PAGE_ACCESSED. Number 2 adds _PAGE_NX to the above,
> and number 3 adds _PAGE_GLOBAL to the bits in variation 1.
> 
>  From the code in arch/x86/mm/pageattr.c, I figured I need to call
> set_pages_wb() unconditionally, and set_pages_nx() if _PAGE_NX is
> set. Will these calls be sufficient? I thought about calling
> set_pages_rw(), but that entry is not exported.

it depends on what the code is trying to achieve.
(this makes it not a trivial 1:1 scripted replacement ;-)

Which attribute is the code trying to change? Is it trying to make
a piece of code (non) cachable? or executable? You need to figure out what
the intent is..


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

* Re: Query about set_pages_* API
  2008-02-09 22:40 Query about set_pages_* API Larry Finger
  2008-02-09 23:57 ` Arjan van de Ven
@ 2008-02-10  0:00 ` Arjan van de Ven
  2008-02-10 17:15   ` Larry Finger
  1 sibling, 1 reply; 4+ messages in thread
From: Arjan van de Ven @ 2008-02-10  0:00 UTC (permalink / raw)
  To: Larry Finger; +Cc: LKML

On Sat, 09 Feb 2008 15:40:12 -0700
Larry Finger <Larry.Finger@lwfinger.net> wrote:

> Is the set_pages_* API that replaces change_page_attr described
> somewhere? I have been unable to find it with Google.
> 
> I'm trying to modify the VirtualBox kernel module to work with
> 2.6.24-git (and 2.6.25) on x86_64 architecture. The current code has
> a value of the third argument of the call (prot) with 3 variants. All
> variations have the following bits set: _PAGE_PRESENT, _PAGE_RW,
> _PAGE_DIRTY, and _PAGE_ACCESSED. Number 2 adds _PAGE_NX to the above,
> and number 3 adds _PAGE_GLOBAL to the bits in variation 1.
> 
>  From the code in arch/x86/mm/pageattr.c, I figured I need to call
> set_pages_wb() unconditionally, and set_pages_nx() if _PAGE_NX is
> set. Will these calls be sufficient? I thought about calling
> set_pages_rw(), but that entry is not exported.
> 

ok looking at the actual code.. it seems to only care about making a piece of memory executable 
(and then clearing it before freeing), so all you need is set_memory_x() and set_memory_nx()



-- 
If you want to reach me at my work email, use arjan@linux.intel.com
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org

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

* Re: Query about set_pages_* API
  2008-02-10  0:00 ` Arjan van de Ven
@ 2008-02-10 17:15   ` Larry Finger
  0 siblings, 0 replies; 4+ messages in thread
From: Larry Finger @ 2008-02-10 17:15 UTC (permalink / raw)
  To: Arjan van de Ven; +Cc: LKML

Arjan van de Ven wrote:
> On Sat, 09 Feb 2008 15:40:12 -0700
> Larry Finger <Larry.Finger@lwfinger.net> wrote:
> 
>> Is the set_pages_* API that replaces change_page_attr described
>> somewhere? I have been unable to find it with Google.
>>
>> I'm trying to modify the VirtualBox kernel module to work with
>> 2.6.24-git (and 2.6.25) on x86_64 architecture. The current code has
>> a value of the third argument of the call (prot) with 3 variants. All
>> variations have the following bits set: _PAGE_PRESENT, _PAGE_RW,
>> _PAGE_DIRTY, and _PAGE_ACCESSED. Number 2 adds _PAGE_NX to the above,
>> and number 3 adds _PAGE_GLOBAL to the bits in variation 1.
>>
>>  From the code in arch/x86/mm/pageattr.c, I figured I need to call
>> set_pages_wb() unconditionally, and set_pages_nx() if _PAGE_NX is
>> set. Will these calls be sufficient? I thought about calling
>> set_pages_rw(), but that entry is not exported.
>>
> 
> ok looking at the actual code.. it seems to only care about making a piece of memory executable 
> (and then clearing it before freeing), so all you need is set_memory_x() and set_memory_nx()

Thanks for the response. It is working now.

Larry

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

end of thread, other threads:[~2008-02-10 17:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-09 22:40 Query about set_pages_* API Larry Finger
2008-02-09 23:57 ` Arjan van de Ven
2008-02-10  0:00 ` Arjan van de Ven
2008-02-10 17:15   ` Larry Finger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).