All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] mm: unexpected behavior of __ioremap_caller
@ 2021-06-11  4:21 Yaohui Wang
  2021-06-11  4:21 ` [PATCH v2 1/2] mm: fix the pfn calculation mistake in __ioremap_check_ram Yaohui Wang
  2021-06-11  4:21 ` [PATCH v2 2/2] mm: fix boundary judgment issues in kernel/resource.c Yaohui Wang
  0 siblings, 2 replies; 7+ messages in thread
From: Yaohui Wang @ 2021-06-11  4:21 UTC (permalink / raw)
  To: dave.hansen; +Cc: luto, peterz, tglx, mingo, bp, x86, linux-kernel

Due to some boundary calculation & boundary judgment issues,
__ioremap_caller may not work as expected. This may raise the risk of
misusing ioremap_xxx functions, and further, incur terrible performance
issues.

For example, suppose [phys_addr ~ phys_addr + PAGE_SIZE] is normal RAM.
Calling ioremap(phys_addr, PAGE_SIZE-1) will succeed (but it should not).
This will set the cache flag of the phys_addr's directing mapping pte to
be PCD. What's worse, iounmap won't revert this cache flag in the
directing mapping. So the pte in the directing mapping keeps polluted
until we use workarounds (calling ioremap_cache on phys_addr) to fix the
cache bit. If there is important data/code in the polluted page, which is
accessed frequently, then the performance of the machine will drop
terribly.

Here are two patches addressing this issue. The first address the boundary
calculation issue and the second one addresses the boundary judgment
issue.

Yahui Wang (2):
  mm: fix pfn calculation mistake in __ioremap_check_ram
  mm: fix boundary judgement issues

 arch/x86/mm/ioremap.c | 4 ++--
 kernel/resource.c     | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

-- 
2.25.1


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

end of thread, other threads:[~2021-06-21  8:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-11  4:21 [PATCH v2 0/2] mm: unexpected behavior of __ioremap_caller Yaohui Wang
2021-06-11  4:21 ` [PATCH v2 1/2] mm: fix the pfn calculation mistake in __ioremap_check_ram Yaohui Wang
2021-06-19 21:22   ` Thomas Gleixner
2021-06-21  8:06     ` Thomas Gleixner
2021-06-11  4:21 ` [PATCH v2 2/2] mm: fix boundary judgment issues in kernel/resource.c Yaohui Wang
2021-06-19 22:16   ` Thomas Gleixner
2021-06-21  6:12     ` Yaohui Wang

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.