From: David Hildenbrand <david@redhat.com>
To: Oscar Salvador <osalvador@suse.de>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
linuxppc-dev@lists.ozlabs.org,
Michael Ellerman <mpe@ellerman.id.au>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>,
Rashmica Gupta <rashmica.g@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
Mike Rapoport <rppt@kernel.org>, Michal Hocko <mhocko@suse.com>,
Wei Yang <richard.weiyang@linux.alibaba.com>
Subject: Re: [PATCH v2 4/8] powerpc/mm: protect linear mapping modifications by a mutex
Date: Tue, 17 Nov 2020 16:46:40 +0100 [thread overview]
Message-ID: <274264b2-9ec8-bde0-5725-184c8fd5f05e@redhat.com> (raw)
In-Reply-To: <20201117153750.GD15987@linux>
On 17.11.20 16:37, Oscar Salvador wrote:
> On Wed, Nov 11, 2020 at 03:53:18PM +0100, David Hildenbrand wrote:
>> @@ -144,7 +147,9 @@ void __ref arch_remove_linear_mapping(u64 start, u64 size)
>> start = (unsigned long)__va(start);
>> flush_dcache_range_chunked(start, start + size, FLUSH_CHUNK_SIZE);
>>
>> + mutex_lock(&linear_mapping_mutex);
>> ret = remove_section_mapping(start, start + size);
>> + mutex_unlock(&linear_mapping_mutex);
>> WARN_ON_ONCE(ret);
>
> My expertise in this area is low, so bear with me.
>
> Why we do not need to protect flush_dcache_range_chunked and
> vm_unmap_aliases?
>
vm_unmap_aliases does own locking and can handle concurrent calls.
flush_dcache_range_chunked()->flush_dcache_range() ends up as a sequence
of memory barriers paired with dcbf instructions.
dcbf: Copies modified cache blocks to main storage and invalidates the
copy in the data cache.
It's called from various places and no global variables seem to be
involved, so it looks like it doesn't need any kind of locking.
--
Thanks,
David / dhildenb
next prev parent reply other threads:[~2020-11-17 15:46 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-11 14:53 [PATCH v2 0/8] powernv/memtrace: don't abuse memory hot(un)plug infrastructure for memory allocations David Hildenbrand
2020-11-11 14:53 ` [PATCH v2 1/8] powernv/memtrace: don't leak kernel memory to user space David Hildenbrand
2020-11-17 15:13 ` Oscar Salvador
2020-11-11 14:53 ` [PATCH v2 2/8] powernv/memtrace: fix crashing the kernel when enabling concurrently David Hildenbrand
2020-11-17 15:22 ` Oscar Salvador
2020-11-11 14:53 ` [PATCH v2 3/8] powerpc/mm: factor out creating/removing linear mapping David Hildenbrand
2020-11-17 15:27 ` Oscar Salvador
2020-11-11 14:53 ` [PATCH v2 4/8] powerpc/mm: protect linear mapping modifications by a mutex David Hildenbrand
2020-11-17 15:37 ` Oscar Salvador
2020-11-17 15:46 ` David Hildenbrand [this message]
2020-11-11 14:53 ` [PATCH v2 5/8] powerpc/mm: print warning in arch_remove_linear_mapping() David Hildenbrand
2020-11-11 14:53 ` [PATCH v2 6/8] powerepc/book3s64/hash: drop WARN_ON in hash__remove_section_mapping David Hildenbrand
2020-11-17 15:45 ` Oscar Salvador
2020-11-11 14:53 ` [PATCH v2 7/8] powerpc/mm: remove linear mapping if __add_pages() fails in arch_add_memory() David Hildenbrand
2020-11-17 15:51 ` Oscar Salvador
2020-11-17 15:53 ` David Hildenbrand
2020-11-18 2:00 ` Michael Ellerman
2020-11-11 14:53 ` [PATCH v2 8/8] powernv/memtrace: don't abuse memory hot(un)plug infrastructure for memory allocations David Hildenbrand
2020-11-17 16:45 ` Oscar Salvador
2020-11-25 11:57 ` [PATCH v2 0/8] " Michael Ellerman
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=274264b2-9ec8-bde0-5725-184c8fd5f05e@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=benh@kernel.crashing.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mhocko@suse.com \
--cc=mpe@ellerman.id.au \
--cc=osalvador@suse.de \
--cc=paulus@samba.org \
--cc=rashmica.g@gmail.com \
--cc=richard.weiyang@linux.alibaba.com \
--cc=rppt@kernel.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;
as well as URLs for NNTP newsgroup(s).