* [PATCH] highmem: Round down the address passed to kunmap_flush_on_unmap()
@ 2023-01-26 20:07 Matthew Wilcox (Oracle)
2023-01-27 22:53 ` Ira Weiny
0 siblings, 1 reply; 2+ messages in thread
From: Matthew Wilcox (Oracle) @ 2023-01-26 20:07 UTC (permalink / raw)
To: Andrew Morton, Fabio M. De Francesco, Ira Weiny, linux-kernel,
linux-mm
Cc: Matthew Wilcox (Oracle), stable
We already round down the address in kunmap_local_indexed() which is
the other implementation of __kunmap_local(). The only implementation
of kunmap_flush_on_unmap() is PA-RISC which is expecting a page-aligned
address. This may be causing PA-RISC to be flushing the wrong addresses
currently.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Fixes: 298fa1ad5571 ("highmem: Provide generic variant of kmap_atomic*")
Cc: stable@vger.kernel.org
---
include/linux/highmem-internal.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/highmem-internal.h b/include/linux/highmem-internal.h
index 034b1106d022..e098f38422af 100644
--- a/include/linux/highmem-internal.h
+++ b/include/linux/highmem-internal.h
@@ -200,7 +200,7 @@ static inline void *kmap_local_pfn(unsigned long pfn)
static inline void __kunmap_local(const void *addr)
{
#ifdef ARCH_HAS_FLUSH_ON_KUNMAP
- kunmap_flush_on_unmap(addr);
+ kunmap_flush_on_unmap(PTR_ALIGN_DOWN(addr, PAGE_SIZE));
#endif
}
@@ -227,7 +227,7 @@ static inline void *kmap_atomic_pfn(unsigned long pfn)
static inline void __kunmap_atomic(const void *addr)
{
#ifdef ARCH_HAS_FLUSH_ON_KUNMAP
- kunmap_flush_on_unmap(addr);
+ kunmap_flush_on_unmap(PTR_ALIGN_DOWN(addr, PAGE_SIZE));
#endif
pagefault_enable();
if (IS_ENABLED(CONFIG_PREEMPT_RT))
--
2.35.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] highmem: Round down the address passed to kunmap_flush_on_unmap()
2023-01-26 20:07 [PATCH] highmem: Round down the address passed to kunmap_flush_on_unmap() Matthew Wilcox (Oracle)
@ 2023-01-27 22:53 ` Ira Weiny
0 siblings, 0 replies; 2+ messages in thread
From: Ira Weiny @ 2023-01-27 22:53 UTC (permalink / raw)
To: Matthew Wilcox (Oracle), Andrew Morton, Fabio M. De Francesco,
Ira Weiny, linux-kernel, linux-mm
Cc: Matthew Wilcox (Oracle), stable
Matthew Wilcox (Oracle) wrote:
> We already round down the address in kunmap_local_indexed() which is
> the other implementation of __kunmap_local(). The only implementation
> of kunmap_flush_on_unmap() is PA-RISC which is expecting a page-aligned
> address. This may be causing PA-RISC to be flushing the wrong addresses
> currently.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
> Fixes: 298fa1ad5571 ("highmem: Provide generic variant of kmap_atomic*")
> Cc: stable@vger.kernel.org
> ---
> include/linux/highmem-internal.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/highmem-internal.h b/include/linux/highmem-internal.h
> index 034b1106d022..e098f38422af 100644
> --- a/include/linux/highmem-internal.h
> +++ b/include/linux/highmem-internal.h
> @@ -200,7 +200,7 @@ static inline void *kmap_local_pfn(unsigned long pfn)
> static inline void __kunmap_local(const void *addr)
> {
> #ifdef ARCH_HAS_FLUSH_ON_KUNMAP
> - kunmap_flush_on_unmap(addr);
> + kunmap_flush_on_unmap(PTR_ALIGN_DOWN(addr, PAGE_SIZE));
> #endif
> }
>
> @@ -227,7 +227,7 @@ static inline void *kmap_atomic_pfn(unsigned long pfn)
> static inline void __kunmap_atomic(const void *addr)
> {
> #ifdef ARCH_HAS_FLUSH_ON_KUNMAP
> - kunmap_flush_on_unmap(addr);
> + kunmap_flush_on_unmap(PTR_ALIGN_DOWN(addr, PAGE_SIZE));
> #endif
> pagefault_enable();
> if (IS_ENABLED(CONFIG_PREEMPT_RT))
> --
> 2.35.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-01-27 22:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-26 20:07 [PATCH] highmem: Round down the address passed to kunmap_flush_on_unmap() Matthew Wilcox (Oracle)
2023-01-27 22:53 ` Ira Weiny
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).