linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* Question of kmap_atomic
       [not found] <AANLkTilFvE0eyQS7jNQ77OYkJovJugjKRO-fPHjX8CB9@mail.gmail.com>
@ 2010-07-16  0:44 ` Minchan Kim
  2010-07-16  2:10 ` Nicolas Pitre
  2010-07-16  7:46 ` Russell King - ARM Linux
  2 siblings, 0 replies; 6+ messages in thread
From: Minchan Kim @ 2010-07-16  0:44 UTC (permalink / raw)
  To: linux-arm-kernel

Resend with fixing the mail address.

On Fri, Jul 16, 2010 at 9:41 AM, Minchan Kim <minchan.kim@gmail.com> wrote:
> I am stuck with looking at ARM's kmap_atomic.
> I am not familiar with ARM cache model.
> As I look the code, ARM seems to have a VIPT aliasing model.
>
> Before Nicolas's 17ebba1fe, kmap_atomic always calls kmap_high_get to
> prevent aliasing problem of 7929eb9cf64 regardless of VIVT and VIPT.
>
> But the patch made it to not call kmap_high_get when VIPT-aliasing
> model in CONFIG_DEBUG_HIGHMEM.
> Doesn't it cause aliasing problem as 7929eb9cf64 says, again?
>
> --
> Kind regards,
> Minchan Kim
>



-- 
Kind regards,
Minchan Kim

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

* Question of kmap_atomic
       [not found] <AANLkTilFvE0eyQS7jNQ77OYkJovJugjKRO-fPHjX8CB9@mail.gmail.com>
  2010-07-16  0:44 ` Question of kmap_atomic Minchan Kim
@ 2010-07-16  2:10 ` Nicolas Pitre
  2010-07-16  2:31   ` Minchan Kim
  2010-07-16  7:46 ` Russell King - ARM Linux
  2 siblings, 1 reply; 6+ messages in thread
From: Nicolas Pitre @ 2010-07-16  2:10 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, 16 Jul 2010, Minchan Kim wrote:

> I am stuck with looking at ARM's kmap_atomic.
> I am not familiar with ARM cache model.
> As I look the code, ARM seems to have a VIPT aliasing model.

There are VIPT as well as VIVT models available.

> Before Nicolas's 17ebba1fe, kmap_atomic always calls kmap_high_get to
> prevent aliasing problem of 7929eb9cf64 regardless of VIVT and VIPT.

The aliasing issue is fundamental for VIVT.  But on VIPT it is also 
advantageous to reuse a kmap entry if possible as this saves on the PTE 
setup and TLB flush that is required otherwise.

> But the patch made it to not call kmap_high_get when VIPT-aliasing
> model in CONFIG_DEBUG_HIGHMEM.
> Doesn't it cause aliasing problem as 7929eb9cf64 says, again?

No because with VIPT, the cache is tagged with physical addresses, and 
therefore the same cache data will be used for the same memory 
regardless of the virtual address used to reach it.  On VIVT this is not 
the case and the comment in 7929eb9cf64 applies to VIVT only.


Nicolas

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

* Question of kmap_atomic
  2010-07-16  2:10 ` Nicolas Pitre
@ 2010-07-16  2:31   ` Minchan Kim
  2010-07-16  2:46     ` Nicolas Pitre
  0 siblings, 1 reply; 6+ messages in thread
From: Minchan Kim @ 2010-07-16  2:31 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jul 16, 2010 at 11:10 AM, Nicolas Pitre <nico@fluxnic.net> wrote:
> On Fri, 16 Jul 2010, Minchan Kim wrote:
>
>> I am stuck with looking at ARM's kmap_atomic.
>> I am not familiar with ARM cache model.
>> As I look the code, ARM seems to have a VIPT aliasing model.
>
> There are VIPT as well as VIVT models available.
>
>> Before Nicolas's 17ebba1fe, kmap_atomic always calls kmap_high_get to
>> prevent aliasing problem of 7929eb9cf64 regardless of VIVT and VIPT.
>
> The aliasing issue is fundamental for VIVT. ?But on VIPT it is also
> advantageous to reuse a kmap entry if possible as this saves on the PTE
> setup and TLB flush that is required otherwise.
>
>> But the patch made it to not call kmap_high_get when VIPT-aliasing
>> model in CONFIG_DEBUG_HIGHMEM.
>> Doesn't it cause aliasing problem as 7929eb9cf64 says, again?
>
> No because with VIPT, the cache is tagged with physical addresses, and
> therefore the same cache data will be used for the same memory
> regardless of the virtual address used to reach it. ?On VIVT this is not
> the case and the comment in 7929eb9cf64 applies to VIVT only.

Thanks for quick reply, Nicolas.

My concern is following as.

In VIPT alising model,

I mean
[N-1:5] = virtual index
[31:N] = physical tag

where N > PAGE_SHIFT,

1. kmap uses a page A
2. kunmap just decrease pkmcp count of page A but not flush the cache.
3. Unfortunately, kmap_atomic uses a page A with different virtual
address. (fixmap)
4. write page A
5. kunmap_atomic
6. someone call kmap a page B
7. flush_all_zero_pkmaps flush page A and lost 4's content.

I might be misunderstaning. Please correct me.


-- 
Kind regards,
Minchan Kim

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

* Question of kmap_atomic
  2010-07-16  2:31   ` Minchan Kim
@ 2010-07-16  2:46     ` Nicolas Pitre
  2010-07-16  2:52       ` Minchan Kim
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Pitre @ 2010-07-16  2:46 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, 16 Jul 2010, Minchan Kim wrote:

> >> But the patch made it to not call kmap_high_get when VIPT-aliasing
> >> model in CONFIG_DEBUG_HIGHMEM.
> >> Doesn't it cause aliasing problem as 7929eb9cf64 says, again?
> >
> > No because with VIPT, the cache is tagged with physical addresses, and
> > therefore the same cache data will be used for the same memory
> > regardless of the virtual address used to reach it. ?On VIVT this is not
> > the case and the comment in 7929eb9cf64 applies to VIVT only.
> 
> Thanks for quick reply, Nicolas.
> 
> My concern is following as.
> 
> In VIPT alising model,
[...]

Highmem is not supported with VIPT alising and probably will never be. 
See commit 3f973e22.


Nicolas

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

* Question of kmap_atomic
  2010-07-16  2:46     ` Nicolas Pitre
@ 2010-07-16  2:52       ` Minchan Kim
  0 siblings, 0 replies; 6+ messages in thread
From: Minchan Kim @ 2010-07-16  2:52 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jul 16, 2010 at 11:46 AM, Nicolas Pitre <nico@fluxnic.net> wrote:
> On Fri, 16 Jul 2010, Minchan Kim wrote:
>
>> >> But the patch made it to not call kmap_high_get when VIPT-aliasing
>> >> model in CONFIG_DEBUG_HIGHMEM.
>> >> Doesn't it cause aliasing problem as 7929eb9cf64 says, again?
>> >
>> > No because with VIPT, the cache is tagged with physical addresses, and
>> > therefore the same cache data will be used for the same memory
>> > regardless of the virtual address used to reach it. ?On VIVT this is not
>> > the case and the comment in 7929eb9cf64 applies to VIVT only.
>>
>> Thanks for quick reply, Nicolas.
>>
>> My concern is following as.
>>
>> In VIPT alising model,
> [...]
>
> Highmem is not supported with VIPT alising and probably will never be.
> See commit 3f973e22.

It's clear.
Thanks, Nicolas.


-- 
Kind regards,
Minchan Kim

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

* Question of kmap_atomic
       [not found] <AANLkTilFvE0eyQS7jNQ77OYkJovJugjKRO-fPHjX8CB9@mail.gmail.com>
  2010-07-16  0:44 ` Question of kmap_atomic Minchan Kim
  2010-07-16  2:10 ` Nicolas Pitre
@ 2010-07-16  7:46 ` Russell King - ARM Linux
  2 siblings, 0 replies; 6+ messages in thread
From: Russell King - ARM Linux @ 2010-07-16  7:46 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jul 16, 2010 at 09:41:59AM +0900, Minchan Kim wrote:
> I am stuck with looking at ARM's kmap_atomic.
> I am not familiar with ARM cache model.
> As I look the code, ARM seems to have a VIPT aliasing model.
> 
> Before Nicolas's 17ebba1fe, kmap_atomic always calls kmap_high_get to
> prevent aliasing problem of 7929eb9cf64 regardless of VIVT and VIPT.
> 
> But the patch made it to not call kmap_high_get when VIPT-aliasing
> model in CONFIG_DEBUG_HIGHMEM.
> Doesn't it cause aliasing problem as 7929eb9cf64 says, again?

There's various problems with highmem and VIPT aliasing caches, so we don't
permit its use with such caches.

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

end of thread, other threads:[~2010-07-16  7:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <AANLkTilFvE0eyQS7jNQ77OYkJovJugjKRO-fPHjX8CB9@mail.gmail.com>
2010-07-16  0:44 ` Question of kmap_atomic Minchan Kim
2010-07-16  2:10 ` Nicolas Pitre
2010-07-16  2:31   ` Minchan Kim
2010-07-16  2:46     ` Nicolas Pitre
2010-07-16  2:52       ` Minchan Kim
2010-07-16  7:46 ` Russell King - ARM Linux

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).