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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 844F8C433EF for ; Mon, 13 Dec 2021 10:17:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mTsj+a8mJ0r5TxbZ2M+Q1lExce+hj78e7ezNSaipBJU=; b=n0tiXnWvYyvVbH b939iZ7l2j/R/Y4kfjk+5JqXDnzp+o+K8KaqAPVxJzuoVb1O5uzjdw0oJikp1lNIMHr8zRzZJYO7e oHRNpMQrWLCT+/s4x7RtgiX5+OM3MKzimEOyIucVOYSNSxk5EuPadPMfANmqPR+jOZgWAX3rc43B2 NTynO/RvLyH7kMimLTAKuUYpUyOX28T+c4J1Z8rZGh16Q4C6aq2AuJSl2yaPpgalne4kefg+trXd+ 2IJOi39AvgtMbNEy2+r0w/7uPQLZnd+qBQQqwZhQahFiX5EovA+MZq91ls3Hou9oXeTX8lOMjXxen +LE9Vwb2IgSNTVXtHAjg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mwiNR-008wCd-2Q; Mon, 13 Dec 2021 10:16:14 +0000 Received: from sin.source.kernel.org ([145.40.73.55]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mwi59-008o2M-5y for linux-arm-kernel@lists.infradead.org; Mon, 13 Dec 2021 09:57:20 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 8173ECE0E6F; Mon, 13 Dec 2021 09:57:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6FE1C34602; Mon, 13 Dec 2021 09:57:11 +0000 (UTC) Date: Mon, 13 Dec 2021 09:57:08 +0000 From: Catalin Marinas To: David Hildenbrand Cc: Jianyong Wu , Anshuman Khandual , "will@kernel.org" , "akpm@linux-foundation.org" , "ardb@kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "gshan@redhat.com" , Justin He , nd Subject: Re: [PATCH v2] arm64/mm: avoid fixmap race condition when create pud mapping Message-ID: References: <20211210095432.51798-1-jianyong.wu@arm.com> <3366ba9f-5993-1c52-de0c-53e618f20cd8@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <3366ba9f-5993-1c52-de0c-53e618f20cd8@redhat.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211213_015719_485681_0A8007EB X-CRM114-Status: GOOD ( 17.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Dec 13, 2021 at 08:37:04AM +0100, David Hildenbrand wrote: > On 13.12.21 08:27, Jianyong Wu wrote: > >>> @@ -359,6 +365,7 @@ static void alloc_init_pud(pgd_t *pgdp, unsigned long addr, unsigned long end, > >>> } while (pudp++, addr = next, addr != end); > >>> > >>> pud_clear_fixmap(); > >>> + spin_unlock(&fixmap_lock); > >>> } > >>> > >>> static void __create_pgd_mapping(pgd_t *pgdir, phys_addr_t phys, > >>> > >> > >> As the race could only happen with memory hotplug being enabled, could > >> not we wrap this around with CONFIG_MEMORY_HOTPLUG, just to narrow > >> its scope possibly speed up other non-hotplug cases ? Assuming you can quantify the speed-up... > > I think it's better. > > We better avoid using ifdef if not really necessary, it just uglifies > the code. We could add > > if (IS_ENABLED(CONFIG_MEMORY_HOTPLUG)) > ... > > But should we really try to micto-optimize this code and make it harder > to read for the purpose of an unproven performance gain? (if there is no > contention, we'll most probably not even recognize that we're taking a lock) I agree, I don't see the point of this optimisation. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CFECC43217 for ; Mon, 13 Dec 2021 10:03:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240827AbhLMKCn (ORCPT ); Mon, 13 Dec 2021 05:02:43 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:44116 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239398AbhLMJ5Q (ORCPT ); Mon, 13 Dec 2021 04:57:16 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DBBCDB80DEC for ; Mon, 13 Dec 2021 09:57:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6FE1C34602; Mon, 13 Dec 2021 09:57:11 +0000 (UTC) Date: Mon, 13 Dec 2021 09:57:08 +0000 From: Catalin Marinas To: David Hildenbrand Cc: Jianyong Wu , Anshuman Khandual , "will@kernel.org" , "akpm@linux-foundation.org" , "ardb@kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "gshan@redhat.com" , Justin He , nd Subject: Re: [PATCH v2] arm64/mm: avoid fixmap race condition when create pud mapping Message-ID: References: <20211210095432.51798-1-jianyong.wu@arm.com> <3366ba9f-5993-1c52-de0c-53e618f20cd8@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3366ba9f-5993-1c52-de0c-53e618f20cd8@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 13, 2021 at 08:37:04AM +0100, David Hildenbrand wrote: > On 13.12.21 08:27, Jianyong Wu wrote: > >>> @@ -359,6 +365,7 @@ static void alloc_init_pud(pgd_t *pgdp, unsigned long addr, unsigned long end, > >>> } while (pudp++, addr = next, addr != end); > >>> > >>> pud_clear_fixmap(); > >>> + spin_unlock(&fixmap_lock); > >>> } > >>> > >>> static void __create_pgd_mapping(pgd_t *pgdir, phys_addr_t phys, > >>> > >> > >> As the race could only happen with memory hotplug being enabled, could > >> not we wrap this around with CONFIG_MEMORY_HOTPLUG, just to narrow > >> its scope possibly speed up other non-hotplug cases ? Assuming you can quantify the speed-up... > > I think it's better. > > We better avoid using ifdef if not really necessary, it just uglifies > the code. We could add > > if (IS_ENABLED(CONFIG_MEMORY_HOTPLUG)) > ... > > But should we really try to micto-optimize this code and make it harder > to read for the purpose of an unproven performance gain? (if there is no > contention, we'll most probably not even recognize that we're taking a lock) I agree, I don't see the point of this optimisation. -- Catalin