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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8BB1EC77B73 for ; Wed, 19 Apr 2023 07:54:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DBBF88E0003; Wed, 19 Apr 2023 03:54:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D6BFB8E0001; Wed, 19 Apr 2023 03:54:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C33248E0003; Wed, 19 Apr 2023 03:54:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id B445F8E0001 for ; Wed, 19 Apr 2023 03:54:14 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 74D16ABE86 for ; Wed, 19 Apr 2023 07:54:14 +0000 (UTC) X-FDA: 80697377628.07.11BA476 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf27.hostedemail.com (Postfix) with ESMTP id E50D640014 for ; Wed, 19 Apr 2023 07:54:11 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=KEl+iPBF; spf=pass (imf27.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1681890852; h=from:from:sender: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:dkim-signature; bh=Ku4/Si8D6xrlYmDkiBxBM7QW/Zhm4h1GUH6h0hqbhBo=; b=TB06zJt8xUblrydowm7BXcj+FNDvac/0W93DRYsl0LAy+bPa5tPEz3SK9EdTGwPQu+ll29 5vO9e6m2GwTVxnEamQr60bCIXWQrfrT3OaFfqMIXavtIxKkO7Fov9RLHmLVo5PMKWeqKES Atzwg4QJJIRJYaGutazK59LPVCezgkk= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=KEl+iPBF; spf=pass (imf27.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681890852; a=rsa-sha256; cv=none; b=2Kn5dci5XICEgvVbjvLoHNm3Sr/074ilZXJvOTrGW6fPn1iqAmVIJYXIA+9Ou/gkwMo1rB IZl2tGTqGEtA1wJpqNlk47eOHBR3Ahr3CuCwRqE6nrtB/ILmL0wwacgExdmK11k3geXcPo nqHQbjhsHUiWj9rzuK4QnQWVjg+s/Ws= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681890851; 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=Ku4/Si8D6xrlYmDkiBxBM7QW/Zhm4h1GUH6h0hqbhBo=; b=KEl+iPBF+usjCmxggqrsRVXnav4zRJuun8FrN9XXc+MKcjf0bERK0b1H1FCAyzVksqFg77 iEcyx6SxHhLMZKFKSu0kA8NOs/iFynlywZEXMJIbk9G4Rtkf34FiYn4HLI+tN9iYrZciI+ o7nsSzj1VMsuNi31HJqUWJTCDeJhSus= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-287-5goRLVd4MKehYQD1ncsLrA-1; Wed, 19 Apr 2023 03:54:09 -0400 X-MC-Unique: 5goRLVd4MKehYQD1ncsLrA-1 Received: by mail-wm1-f70.google.com with SMTP id fl8-20020a05600c0b8800b003f16fe94249so817241wmb.9 for ; Wed, 19 Apr 2023 00:54:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681890849; x=1684482849; h=content-transfer-encoding:in-reply-to:subject:organization:from :references:cc:to:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Ku4/Si8D6xrlYmDkiBxBM7QW/Zhm4h1GUH6h0hqbhBo=; b=Odvzg9dfthjGMT9OzxMJ1V4gVuhNWebWHPD+gVj85/ZxtHxkWy/f0ZKH813unynLsx kV3KK901M5xt7f92rbmZW2cPEOgUk/Q6KGTo1grWBgSh38OtDwGl3gZxiA6OfO2zAhlg BD039GVm+zvnH8/9/PolLYMOd0yj/vlxOu5zt8jBBcrtHh7uUKXOKCyrkJy7ukPvZc0L 7iQmWjxx/nOq8ob+WeGst+LFw/c9taaKLirTX+MXv4WvM54xiWdBnQ9QZHOyeHtCaVtN 0Fd4ItkEPdDFHUjx2tA+bhZc3ybcTBOIRhC+WBuSLhzdvtKubqQ6OmFFJNKhroDC2YGF phvQ== X-Gm-Message-State: AAQBX9dfWiuuiW0VOwo3Uwod/2LbHqEys0IhZMK/wvCMAq6nDpUFo+vp KBSUf90F39D6UV9moKpFdwrKTndcb4VjVd5R3Ll8hPbEWcRsTYLKfLq6eSP9ZelrCfJnyD1LSR3 egPWy0PSL96M= X-Received: by 2002:a05:600c:2305:b0:3f1:728a:1881 with SMTP id 5-20020a05600c230500b003f1728a1881mr7565077wmo.31.1681890848810; Wed, 19 Apr 2023 00:54:08 -0700 (PDT) X-Google-Smtp-Source: AKy350ZGeCzv8hHHPCLoBp3+kn6wkQN0cMnv6OhMvvwsxXxMwENw712YUrmrVhvIskYHJBvgTLUksw== X-Received: by 2002:a05:600c:2305:b0:3f1:728a:1881 with SMTP id 5-20020a05600c230500b003f1728a1881mr7565048wmo.31.1681890848428; Wed, 19 Apr 2023 00:54:08 -0700 (PDT) Received: from ?IPV6:2003:cb:c70b:7b00:7c52:a5fa:8004:96fd? (p200300cbc70b7b007c52a5fa800496fd.dip0.t-ipconnect.de. [2003:cb:c70b:7b00:7c52:a5fa:8004:96fd]) by smtp.gmail.com with ESMTPSA id l26-20020a1ced1a000000b003eeb1d6a470sm1327085wmh.13.2023.04.19.00.54.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 19 Apr 2023 00:54:08 -0700 (PDT) Message-ID: Date: Wed, 19 Apr 2023 09:54:06 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 To: Vishal Moola Cc: Andrew Morton , Matthew Wilcox , linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org References: <20230417205048.15870-1-vishal.moola@gmail.com> <20230417205048.15870-2-vishal.moola@gmail.com> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH 01/33] s390: Use _pt_s390_gaddr for gmap address tracking In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: meoe5in5g91tcawxniosxo3ojjsnbwm4 X-Rspamd-Queue-Id: E50D640014 X-HE-Tag: 1681890851-295680 X-HE-Meta: U2FsdGVkX18Bb6TPejRXm0z09N/VPN0WU/hRtSXFCN+1JGs/3A46bSglAzQA9YJWWYfRSY8yb18yU2TtFrYXRI1/4EmHaGRt10v0cc9FeMkKcR5xdqG6wOljytRv+qCqIWQsItzvB7Fnmb8Gzmo7zwOv6yFmB7e+820+OrowZNtaAWV2uRi2ZfOw9JnNTMawwULGgb1P0f4tq+X+iQsOqaT1wDWDJu843HL0fx+KhWaM/DsIcm0cQXkHtGggvK/boUcbEYk3vyZtFLH8QA4uoYE65kAZZ3P3buAuEvzS5N0t9rn9rCpuS5uhpdEMVqcXAI6NlXOaD4MQ8kUsn+hKeEpPOoaTgoQd99ZsJcxrFnE3DdCSVQWIMh9IDnFWJyMfHiSeM3ZCsr1reo+4TvhkCUQ7AGUXuvtTK6bTZVfNLO6s46x/0UJVJLmfiQIO/bMR3fv5dKAa4nFlgNSGMMM9fVRra11a0Sc+IfxdBW7GsPiz18ZV2M5t/GUcMWH2R6MJYFldf0V4agnIt8/VL3uEsAnqxgO2DIGJAMebsrHN9hSr/jB9LaY3AadNJIuOrAlK8GJnUkAKc2n24usXFz4PSs2t9ENUglF+udcopvBPAfoHwGNC4c7rnnmZ34c+CDvFDN/xreDzuXt3+edvOBsb7vO0HVX7L3ouqqgclKPGnftoIAFt4fNuCNqtW2dIJKecRR9C486rgsq7BWJemqJwAAlzV2UP2gaz/if22UAgpZb0opgXmU51uRDp/4aFI/4+PXhpzMCxPymCpuiFdAHiy4RA14/WIQ6/M3fDO1anrdltRZf/zymWb8Bg5PkxZENeK/S6bLzQOH0b61HO6MiZHR8qzhynC1nRyxE8kzJ9DH8EfcqHGk7vO+yHf91h0Ll1ETPLBEXqkdlm2EtdMPdEDi1YtD06HYq60sp8yMffUon20EmkAs0aFXxaH6vS8roVpCiWfnhr3wgOVrovFp5 yxN71+je 0vkV0IU6tiK5vHd73KEdz81+CBuTJ1A5/BvGqRZfTQI7QuXlkqCjHzhPWUIu5NIDgIkxWYD32Y7YyDNeYCKbwtqqLWc2lr/1DkcUwXlvJ0BI3mnuZ6OMkb0iRbxRq00zvFFJV28PSZIxC81/ekX7S6IGvPO38aU3wXrWLiC0wgKdFYHeaZ3SuqmSOdv/V86rbQXNGskGeJlgWc/D22H5P23iZ58i0Rik+LjIEELrai/vuDFrwYf7lCxU3s2Z3HxW8yA7vQsotwD1XGBz5TaDfMm2tSJjQDnteFSoDdSnIEp1hJzUOIoJE4RrmTdY4zXTG955vmqHq99o9tK1AjpRvFHOeAwbjK56jAEtgAbu/6gde5bY7uZjYBQ4BQpy1fYUZwFTXxI7Has0xJdDkHR+jt/on26xZGvVQQ6c1SplbNLTVcpL5Z7Sk6pPOw210R2On+vZ5N2/7e7PTBO5zNNYAXwF8iOXcjCVlU+xFbyvN32C3TzVrb4CDz2QYnnZejwMrElTbpC6Q+sbQ3NWX4AEY3Ez5ZeioMhKiTlccLZVFKSrKrDx4WLnqE+fiwjqpcX29uogn 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 18.04.23 23:33, Vishal Moola wrote: > On Tue, Apr 18, 2023 at 8:45 AM David Hildenbrand wrote: >> >> On 17.04.23 22:50, Vishal Moola (Oracle) wrote: >>> s390 uses page->index to keep track of page tables for the guest address >>> space. In an attempt to consolidate the usage of page fields in s390, >>> replace _pt_pad_2 with _pt_s390_gaddr to replace page->index in gmap. >>> >>> This will help with the splitting of struct ptdesc from struct page, as >>> well as allow s390 to use _pt_frag_refcount for fragmented page table >>> tracking. >>> >>> Since page->_pt_s390_gaddr aliases with mapping, ensure its set to NULL >>> before freeing the pages as well. >>> >>> Signed-off-by: Vishal Moola (Oracle) >>> --- >> >> [...] >> >>> diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h >>> index 3fc9e680f174..2616d64c0e8c 100644 >>> --- a/include/linux/mm_types.h >>> +++ b/include/linux/mm_types.h >>> @@ -144,7 +144,7 @@ struct page { >>> struct { /* Page table pages */ >>> unsigned long _pt_pad_1; /* compound_head */ >>> pgtable_t pmd_huge_pte; /* protected by page->ptl */ >>> - unsigned long _pt_pad_2; /* mapping */ >>> + unsigned long _pt_s390_gaddr; /* mapping */ >>> union { >>> struct mm_struct *pt_mm; /* x86 pgds only */ >>> atomic_t pt_frag_refcount; /* powerpc */ >> >> The confusing part is, that these gmap page tables are not ordinary >> process page tables that we would ordinarily place into this section >> here. That's why they are also not allocated/freed using the typical >> page table constructor/destructor ... > > I initially thought the same, so I was quite confused when I saw > __gmap_segment_gaddr was using pmd_pgtable_page(). > > Although they are not ordinary process page tables, since we > eventually want to move them out of struct page, I think shifting them > to be in ptdescs, being a memory descriptor for page tables, makes > the most sense. Seeing utilities like tlb_remove_page_ptdesc() that don't really apply to such page tables, I wonder if we should much rather treat such shadow/auxiliary/... page tables (just like other architectures like x86, arm, ... employ as well) as a distinct type. And have ptdesc be the common type for all process page tables. > > Another option is to leave pmd_pgtable_page() as is just for this case. > Or we can revert commit 7e25de77bc5ea which uses the function here > then figure out where these gmap pages table pages will go later. I'm always confused when reading gmap code, so let me have another look :) The confusing part is that s390x shares the lowest level page tables (PTE tables) between the process and gmap ("guest mapping", similar to EPT on x86-64). It maps these process PTE tables (covering 1 MiB) into gmap-specific PMD tables. pmd_pgtable_page() should indeed always give us a gmap-specific PMD-table. In fact, something allocated via gmap_alloc_table(). Decoupling both concepts sounds like a good idea. -- Thanks, David / dhildenb