Skip to contentSkip to conversation

mm/highmem: Align-down to page the address for kunmap_flush_on_unmap()

PATCH In review Fabio M. De Francesco 1 participant 2 messages Jan 26, 2023 Memory management

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm/highmem: Align-down to page the address for kunmap_flush_on_unmap()

If ARCH_HAS_FLUSH_ON_KUNMAP is defined (PA-RISC case), __kunmap_local() calls kunmap_flush_on_unmap(). The latter currently flushes the wrong address (as confirmed by Matthew Wilcox and Helge Deller). Al Viro proposed to call kunmap_flush_on_unmap() on an aligned-down to page address in order to fix this issue. Consensus has been reached on this solution.

Therefore, if ARCH_HAS_FLUSH_ON_KUNMAP is defined, call kunmap_flush_on_unmap() on an aligned-down to page address computed with the PTR_ALIGN_DOWN() macro.

Cc Ira Weiny <[email protected]>
Fixes f3ba3c710ac5 ("mm/highmem: Provide kmap_local*")

---

I have (at least) two problems with this patch...

1) checkpatch.pl complains about the use of the non-standard "Confirmed-by" tags. I don't know how else I can give credit to Helge and Matthew. However, this is not the first time that I see non-standard tags in patches applied upstream (I too had a non-standard "Analysed-by" tag in patch which fixes a SAC bug). Any objections?

2) I'm not sure whether or not the "Fixes" tag is appropriate in this patch. Can someone either confirm or deny it?

 include/linux/highmem-internal.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/highmem-internal.h +1 -1
index 034b1106d022..e247c9ac4583 100644
@@ -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
 }
 
Signature · 1 line
2.39.0
#1 lore raw
Quoted 47 lines · On giovedì 26 gennaio 2023 15:11:44 CET Fabio M. De Francesco wrote:

If ARCH_HAS_FLUSH_ON_KUNMAP is defined (PA-RISC case), __kunmap_local() calls kunmap_flush_on_unmap(). The latter currently flushes the wrong address (as confirmed by Matthew Wilcox and Helge Deller). Al Viro proposed to call kunmap_flush_on_unmap() on an aligned-down to page address in order to fix this issue. Consensus has been reached on this solution.

Therefore, if ARCH_HAS_FLUSH_ON_KUNMAP is defined, call kunmap_flush_on_unmap() on an aligned-down to page address computed with the PTR_ALIGN_DOWN() macro.

Cc Ira Weiny <[email protected]>
Fixes f3ba3c710ac5 ("mm/highmem: Provide kmap_local*")

---

I have (at least) two problems with this patch...

1) checkpatch.pl complains about the use of the non-standard "Confirmed-by" tags. I don't know how else I can give credit to Helge and Matthew. However, this is not the first time that I see non-standard tags in patches applied upstream (I too had a non-standard "Analysed-by" tag in patch which fixes a SAC bug). Any objections?

2) I'm not sure whether or not the "Fixes" tag is appropriate in this patch. Can someone either confirm or deny it?

 include/linux/highmem-internal.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/include/linux/highmem-internal.h index 034b1106d022..e247c9ac4583 100644

include/linux/highmem-internal.h +1 -2
@@ -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
 }
 
--
Quoted 1 line

2.39.0

I just realized that I forgot to Cc Thomas Gleixner. Therefore, I think I'd better add him to the list and resend this patch.

I'm doing it immediately, so please drop this.

Thanks,

Fabio