public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [patch] arch hook for notifying changes in PTE protections bits
       [not found] <20050318162943.A3157@unix-os.sc.intel.com>
@ 2005-03-19  4:05 ` David S. Miller
  2005-03-19 20:22   ` Seth, Rohit
  2005-03-20 22:38   ` Seth, Rohit
  0 siblings, 2 replies; 5+ messages in thread
From: David S. Miller @ 2005-03-19  4:05 UTC (permalink / raw)
  To: Seth, Rohit; +Cc: linux-ia64, linux-kernel, davidm


This is way overkill I think.

Take a look at set_pte_at().  You get the "mm", the
virtual address, the pte pointer, and the new pte value.

What else could you possibly need to track stuff like this
and react appropriately? :-)

It is even an argument for batched TLB processing on ia64.
It simplifies a lot of cache flushing issues and you can
control the flushing on a per-translation basis however
you like.

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

* RE: [patch] arch hook for notifying changes in PTE protections bits
  2005-03-19  4:05 ` [patch] arch hook for notifying changes in PTE protections bits David S. Miller
@ 2005-03-19 20:22   ` Seth, Rohit
  2005-03-19 20:30     ` David Mosberger
  2005-03-20 22:38   ` Seth, Rohit
  1 sibling, 1 reply; 5+ messages in thread
From: Seth, Rohit @ 2005-03-19 20:22 UTC (permalink / raw)
  To: David S. Miller; +Cc: linux-ia64, linux-kernel, davidm

David S. Miller <mailto:davem@davemloft.net> wrote on Friday, March 18,
2005 8:06 PM:

> 
> Take a look at set_pte_at().  You get the "mm", the
> virtual address, the pte pointer, and the new pte value.
> 

Thanks for pointing out the updated interface in 2.6.12-* kernel.  I
think I can overload the arch specific part of set_pte_at(or for that
matter set_pte, as what I need is only pte_t) to always check if we need
to do lazy I/D coherency for IA-64.....but this incurs extra cost for
making a check every time set_pte_at is called.  This new hook,
lazy_mmu_prot_update, though needs to be used only when the permissions
on a valid PTE is changing. For example, at the time of remap or swap,
this API is not called.
  
> What else could you possibly need to track stuff like this
> and react appropriately? :-)
> 

Stuff is there, though the call needs to be made to ensure we are
reacting to it most optimally and correctly.....I guess something
similar to why update_mmu_cache API is still existing in generic part
and not overloading arch specific set_pte_at definition.


-rohit

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

* RE: [patch] arch hook for notifying changes in PTE protections bits
  2005-03-19 20:22   ` Seth, Rohit
@ 2005-03-19 20:30     ` David Mosberger
  2005-03-20  0:27       ` David S. Miller
  0 siblings, 1 reply; 5+ messages in thread
From: David Mosberger @ 2005-03-19 20:30 UTC (permalink / raw)
  To: Seth, Rohit; +Cc: David S. Miller, linux-ia64, linux-kernel, davidm

>>>>> On Sat, 19 Mar 2005 12:22:20 -0800, "Seth, Rohit" <rohit.seth@intel.com> said:

  Rohit> David S. Miller <mailto:davem@davemloft.net> wrote on Friday,
  Rohit> March 18, 2005 8:06 PM:

  >>  Take a look at set_pte_at().  You get the "mm", the virtual
  >> address, the pte pointer, and the new pte value.


  Rohit> Thanks for pointing out the updated interface in 2.6.12-*
  Rohit> kernel.  I think I can overload the arch specific part of
  Rohit> set_pte_at(or for that matter set_pte, as what I need is only
  Rohit> pte_t) to always check if we need to do lazy I/D coherency
  Rohit> for IA-64.....but this incurs extra cost for making a check
  Rohit> every time set_pte_at is called.  This new hook,
  Rohit> lazy_mmu_prot_update, though needs to be used only when the
  Rohit> permissions on a valid PTE is changing. For example, at the
  Rohit> time of remap or swap, this API is not called.

Careful though: not every PTE has an associated page_map entry.

I agree about your concern about cost.  Accessing the page_map is
expensive (integer division + memory access) and we have to do that in
order to find out if the page is i-cache clean.

	--david

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

* Re: [patch] arch hook for notifying changes in PTE protections bits
  2005-03-19 20:30     ` David Mosberger
@ 2005-03-20  0:27       ` David S. Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David S. Miller @ 2005-03-20  0:27 UTC (permalink / raw)
  To: davidm; +Cc: davidm, rohit.seth, linux-ia64, linux-kernel

On Sat, 19 Mar 2005 12:30:05 -0800
David Mosberger <davidm@napali.hpl.hp.com> wrote:

> I agree about your concern about cost.  Accessing the page_map is
> expensive (integer division + memory access) and we have to do that in
> order to find out if the page is i-cache clean.

First, it's a multiply by reciprocol.  At least on sparc64 I get
this emitted by the compiler.

Secondly, if you're willing to sacrifice 8 bytes per page struct
simply define WANT_PAGE_VIRTUAL and page struct will be exactly
64 bytes and thus the divide a will turn into a simple shift.

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

* RE: [patch] arch hook for notifying changes in PTE protections bits
  2005-03-19  4:05 ` [patch] arch hook for notifying changes in PTE protections bits David S. Miller
  2005-03-19 20:22   ` Seth, Rohit
@ 2005-03-20 22:38   ` Seth, Rohit
  1 sibling, 0 replies; 5+ messages in thread
From: Seth, Rohit @ 2005-03-20 22:38 UTC (permalink / raw)
  To: David S. Miller, davidm; +Cc: davidm, linux-ia64, linux-kernel

David S. Miller <mailto:davem@davemloft.net> wrote on Saturday, March
19, 2005 4:27 PM:

> On Sat, 19 Mar 2005 12:30:05 -0800
> David Mosberger <davidm@napali.hpl.hp.com> wrote:
> 
>> I agree about your concern about cost.  Accessing the page_map is
>> expensive (integer division + memory access) and we have to do that
>> in order to find out if the page is i-cache clean.
> 
> First, it's a multiply by reciprocol.  At least on sparc64 I get
> this emitted by the compiler.
> 
> Secondly, if you're willing to sacrifice 8 bytes per page struct
> simply define WANT_PAGE_VIRTUAL and page struct will be exactly
> 64 bytes and thus the divide a will turn into a simple shift.

As said earlier, set_pte_at is getting called from different places.
Not all of these times, we are actually installing valid page entries in
page tables.  Validating the incoming entry for all of these scenarois
(or changing page struct) is an extra overhead that should be
avoided...besides being less palatable as compared to new API.

The recent changes in interfaces, because of set_pte_at, does provide an
opportunity though to handle mprotect issue little differently.  We
could call update_mmu_cache after setting the new protections in
change_pte_range function.....similar to the way update_mmu_cache gets
called at fault and any other times......though for this solution, we
need to extend change_pte_range interface to have vma parameter as well.



-rohit

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

end of thread, other threads:[~2005-03-20 22:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20050318162943.A3157@unix-os.sc.intel.com>
2005-03-19  4:05 ` [patch] arch hook for notifying changes in PTE protections bits David S. Miller
2005-03-19 20:22   ` Seth, Rohit
2005-03-19 20:30     ` David Mosberger
2005-03-20  0:27       ` David S. Miller
2005-03-20 22:38   ` Seth, Rohit

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