From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5DA87C2D0E4 for ; Tue, 17 Nov 2020 15:46:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AE79920855 for ; Tue, 17 Nov 2020 15:46:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="cvbEflrW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AE79920855 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2FDA86B0074; Tue, 17 Nov 2020 10:46:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2B0BA6B0075; Tue, 17 Nov 2020 10:46:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 128CE6B0078; Tue, 17 Nov 2020 10:46:53 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0228.hostedemail.com [216.40.44.228]) by kanga.kvack.org (Postfix) with ESMTP id D5FC26B0074 for ; Tue, 17 Nov 2020 10:46:52 -0500 (EST) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 67DD8824999B for ; Tue, 17 Nov 2020 15:46:52 +0000 (UTC) X-FDA: 77494338264.05.toad98_4e1006727332 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin05.hostedemail.com (Postfix) with ESMTP id 48283180388EA for ; Tue, 17 Nov 2020 15:46:52 +0000 (UTC) X-HE-Tag: toad98_4e1006727332 X-Filterd-Recvd-Size: 3798 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by imf20.hostedemail.com (Postfix) with ESMTP for ; Tue, 17 Nov 2020 15:46:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605628011; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GBRmGBhgNm5FfbhT75FD7IeQ1qhvmL460Gefj3SG1R4=; b=cvbEflrWQKU+hfQVBj15KzazpR/jMGhzxFNvecqbcDQ71r1l8P3yw3hCHVsI050p+Hn0l0 8offOO5Vtk+3imyo9evxiNX8p1o2B4xN36CBgn+mv4VWVZsGY81LbzuLNimUkvwVrbkY0v dHxmzvXgJ4lGFT1CIlQkYl+nR905yFk= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-22-wYOif9G6MPaT8cDgk148ow-1; Tue, 17 Nov 2020 10:46:46 -0500 X-MC-Unique: wYOif9G6MPaT8cDgk148ow-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8725C186DD2C; Tue, 17 Nov 2020 15:46:44 +0000 (UTC) Received: from [10.36.114.99] (ovpn-114-99.ams2.redhat.com [10.36.114.99]) by smtp.corp.redhat.com (Postfix) with ESMTP id CA5035C1CF; Tue, 17 Nov 2020 15:46:41 +0000 (UTC) Subject: Re: [PATCH v2 4/8] powerpc/mm: protect linear mapping modifications by a mutex To: Oscar Salvador Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Rashmica Gupta , Andrew Morton , Mike Rapoport , Michal Hocko , Wei Yang References: <20201111145322.15793-1-david@redhat.com> <20201111145322.15793-5-david@redhat.com> <20201117153750.GD15987@linux> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: <274264b2-9ec8-bde0-5725-184c8fd5f05e@redhat.com> Date: Tue, 17 Nov 2020 16:46:40 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <20201117153750.GD15987@linux> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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