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=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,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 A46C4C433E0 for ; Wed, 8 Jul 2020 12:32:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 52B5F20774 for ; Wed, 8 Jul 2020 12:32:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 52B5F20774 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id AB6026B0033; Wed, 8 Jul 2020 08:32:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A3FF16B00B0; Wed, 8 Jul 2020 08:32:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 956616B00F4; Wed, 8 Jul 2020 08:32:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0162.hostedemail.com [216.40.44.162]) by kanga.kvack.org (Postfix) with ESMTP id 7ED296B0033 for ; Wed, 8 Jul 2020 08:32:50 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 0F2F36105 for ; Wed, 8 Jul 2020 12:32:50 +0000 (UTC) X-FDA: 77014847700.13.egg69_3a1786226ebd Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin13.hostedemail.com (Postfix) with ESMTP id 2B0A8184A76FF for ; Wed, 8 Jul 2020 12:17:40 +0000 (UTC) X-HE-Tag: egg69_3a1786226ebd X-Filterd-Recvd-Size: 4229 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf28.hostedemail.com (Postfix) with ESMTP for ; Wed, 8 Jul 2020 12:17:39 +0000 (UTC) Received: from gaia (unknown [95.146.230.158]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 81D74206C3; Wed, 8 Jul 2020 12:17:35 +0000 (UTC) Date: Wed, 8 Jul 2020 13:17:33 +0100 From: Catalin Marinas To: David Hildenbrand Cc: linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, Will Deacon , Dave P Martin , Vincenzo Frascino , Szabolcs Nagy , Kevin Brodsky , Andrey Konovalov , Peter Collingbourne , Andrew Morton , Christian Borntraeger Subject: Re: [PATCH v6 07/26] mm: Preserve the PG_arch_* flags in __split_huge_page_tail() Message-ID: <20200708121732.GC6308@gaia> References: <20200703153718.16973-1-catalin.marinas@arm.com> <20200703153718.16973-8-catalin.marinas@arm.com> <16aeea8c-b5c4-0d19-2fde-f95ef8dfddc6@redhat.com> <20200706163012.GH28170@gaia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Queue-Id: 2B0A8184A76FF X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 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 Mon, Jul 06, 2020 at 07:56:43PM +0200, David Hildenbrand wrote: > On 06.07.20 18:30, Catalin Marinas wrote: > > On Mon, Jul 06, 2020 at 04:16:13PM +0200, David Hildenbrand wrote: > >> On 03.07.20 17:36, Catalin Marinas wrote: > >>> When a huge page is split into normal pages, part of the head page flags > >>> are transferred to the tail pages. However, the PG_arch_* flags are not > >>> part of the preserved set. > >>> > >>> PG_arch_1 is currently used by the arch code to handle cache maintenance > >>> for user space (either for I-D cache coherency or for D-cache aliases > >>> consistent with the kernel mapping). Since splitting a huge page does > >>> not change the physical or virtual address of a mapping, additional > >>> cache maintenance for the tail pages is unnecessary. Preserving the > >>> PG_arch_1 flag from the head page in the tail pages would not break the > >>> current use-cases. > >> > >> ^ is fairly arm64 specific, no? (I remember that the semantics are > >> different e.g., on s390x). > > > > Not entirely arm64 specific. Apart from s390 and x86, I think all the > > other architectures use this flag for cache maintenance (I guess they > > followed the cachetlb.rst suggestion). My understanding of the s390 and > > x86 is that transferring this flag from the head of a compound page to > > the tail pages should not cause any issue. We don't even document > > anywhere that this flag is meant to disappear on huge page splitting. I > > guess no-one noticed because clearing it is relatively benign. > > On s390x, PG_arch_1 indicates (s390/kernel/uv.c:arch_make_page_accessible()) > - kernel page tables > - for hugetlbfs pages, that storage keys are initialized for that page > (IIRC KVM only) > - a user space page might be encrypted/secure (KVM only) > > The latter does not support hugetlbfs/THP. KVM does not support THP. So > on s390x the bit should never be set in that context and, therefore, > also won't be affected by this change. Thanks for checking. > > But if there are concerns, I'm happy to guard it with something like > > __ARCH_WANT_PG_ARCH_HEAD_TAIL (I need to think of a more suggestive > > name). > > I guess we can avoid that if we properly check+document all users. > (ignoring x86 and s390x behavior here might be dangerous, although my > gut feeling is that it's ok for both) I'll post an independent patch for PG_arch_1 to get consensus among architectures. The PG_arch_2 introduced by the MTE patches can have the new behaviour since it would only be used by arm64 initially. -- Catalin