linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Helge Deller <deller@gmx.de>
To: Ira Weiny <ira.weiny@intel.com>,
	"Fabio M. De Francesco" <fmdefrancesco@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Alexander Potapenko <glider@google.com>,
	Andrey Konovalov <andreyknvl@gmail.com>,
	Tony Luck <tony.luck@intel.com>,
	Bagas Sanjaya <bagasdotme@gmail.com>,
	David Sterba <dsterba@suse.com>,
	Kees Cook <keescook@chromium.org>,
	"Matthew Wilcox (Oracle)" <willy@infradead.org>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Cc: Thomas Gleixner <tglx@linutronix.de>, Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: [PATCH] mm/highmem: Align-down to page the address for kunmap_flush_on_unmap()
Date: Thu, 26 Jan 2023 21:37:08 +0100	[thread overview]
Message-ID: <804f9617-cdad-d3cb-f4c0-7d99d12f49d6@gmx.de> (raw)
In-Reply-To: <63d2d97bce4c7_63e3f29442@iweiny-mobl.notmuch>

On 1/26/23 20:50, Ira Weiny wrote:
> Fabio M. De Francesco wrote:
>
> FWIW I think I would simplify the subject
> [PATCH] mm/highmem: Fix kunmap_local() on flush on unmap architectures
>
> Or something like that.
>
>> 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 <ira.weiny@intel.com>
>> Cc: Thomas Gleixner <tglx@linutronix.de>
>> Suggested-by: Al Viro <viro@zeniv.linux.org.uk>
>> Confirmed-by: Helge Deller <deller@gmx.de>
>> Confirmed-by: Matthew Wilcox <willy@infradead.org>
>> Fixes: f3ba3c710ac5 ("mm/highmem: Provide kmap_local*")
>> Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
>> ---
>>
>> 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?
>
> I think you can add Matthew and Helge as Suggested-by:  All 3 had input on
> the solution.
>
>>
>> 2) I'm not sure whether or not the "Fixes" tag is appropriate in this
>> patch. Can someone either confirm or deny it?
>
> This 'fixes' looks correct to me.  I don't know how many folks are running
> highmem with parisc but if they are I am sure they would appreciate the
> extra knowledge.

It seems nobody is running highmem on parisc, because it can't be enabled.
AFAICS, it's not in any parisc related Kconfig file.

> I do wonder if this should be cc'ed to stable to ensure it gets
> backported?  Helge do you think there is a need for that?

For correctness I think it's nevertheless good to backport it.

>>   include/linux/highmem-internal.h | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/include/linux/highmem-internal.h b/include/linux/highmem-internal.h
>> index 034b1106d022..e247c9ac4583 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
>>   }

That would be another possibility:

diff --git a/arch/parisc/include/asm/cacheflush.h b/arch/parisc/include/asm/cacheflush.h
index 0bdee6724132..ce5d1f8a23bd 100644
--- a/arch/parisc/include/asm/cacheflush.h
+++ b/arch/parisc/include/asm/cacheflush.h
@@ -77,6 +77,7 @@ void flush_anon_page(struct vm_area_struct *vma, struct page *page, unsigned lon
  #define ARCH_HAS_FLUSH_ON_KUNMAP
  static inline void kunmap_flush_on_unmap(const void *addr)
  {
+       addr = PTR_ALIGN_DOWN(addr, PAGE_SIZE);
         flush_kernel_dcache_page_addr(addr);
  }


Helge


  reply	other threads:[~2023-01-26 20:37 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-26 14:33 Fabio M. De Francesco
2023-01-26 19:50 ` Ira Weiny
2023-01-26 20:37   ` Helge Deller [this message]
2023-01-26 20:49     ` Matthew Wilcox
2023-01-27 23:07       ` Ira Weiny
2023-01-26 20:53   ` Al Viro
2023-01-27 22:48     ` Ira Weiny
2023-01-26 20:07 ` Matthew Wilcox
2023-01-27 17:58   ` Fabio M. De Francesco
2023-01-27 18:03     ` Matthew Wilcox
2023-01-26 20:38 ` Andrew Morton
2023-01-26 20:48   ` Matthew Wilcox
2023-01-26 21:04     ` Al Viro
2023-01-26 21:56       ` Matthew Wilcox
2023-01-26 22:17         ` Al Viro
2023-01-27 23:13           ` Ira Weiny
  -- strict thread matches above, loose matches on Subject: below --
2023-01-26 14:11 Fabio M. De Francesco
2023-01-26 14:26 ` Fabio M. De Francesco

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=804f9617-cdad-d3cb-f4c0-7d99d12f49d6@gmx.de \
    --to=deller@gmx.de \
    --cc=akpm@linux-foundation.org \
    --cc=andreyknvl@gmail.com \
    --cc=bagasdotme@gmail.com \
    --cc=bigeasy@linutronix.de \
    --cc=dsterba@suse.com \
    --cc=fmdefrancesco@gmail.com \
    --cc=glider@google.com \
    --cc=ira.weiny@intel.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox